python - How to split egrep print result in to multiple columns and export to a CSV file -


i trying find hardcoded strings in xcode project , export results csv file. below script used giving me list of values along filename 1 string (i.e. /path/classa.m @"value") , when export same results csv file copied in 1 column.

find "${srcroot}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --only-matching "($keywords).*\$" > myfile.csv 

but trying export results in csv want see filename under column , hardocded values in other column.

i newbie in scripting world. please me on this

find "${srcroot}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --only-matching "($keywords).*\$" | sed 's/:/,/' > myfile.csv 

csv represents comma separated values

search , replace first occurrence of : , file , value separated : in case.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -