Using Linux Grep command - need output to text file, cleaner output -


when using grep command find search string in set of files, there way dump results text file? there switch grep command provides cleaner results better readability, such line feed between each entry? perhaps there grep script outputs cleaner results

thanks

grep -n "your search string" * > output-file 

the -n print line number , > redirect grep-results output-file.
if want "clean" results can filter them using pipe | example:
grep -n "test" * | grep -v "mytest" > output-file match lines have string "test" except lines match string "mytest" (that's switch -v) - , redirect result output file.
a few grep-tips can found on post


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -