How would one go about searching many lines of a file for a word, or more specifically, searching for a line that doesnt contain some desired word.
thanks
thanks
grep is your friend.dukebound85 said:How would one go about searching many lines of a file for a word, or more specifically, searching for a line that doesnt contain some desired word.
thanks
dukebound85 said:what about copying certain line numbers from one file and exporting to another?
I am guessing sed may be an option
sed -c "1,5" file > new
this will copy lines 1-5 of file and export to new right?
thanks for all the help so far
balamw said:You can play all kinds of lovely games with grep, sed and awk. So much so they wrote a nice O'Reilly book about them.
with -A and -B so you can look for strings in lines adjacent to matches etc...
I only recently started using xargs (to moitor and clean up the Spam Maildirs on our mail gateway), so I know exactly what you mean!stcanard said:grep, sed, and awk are probably the 3 most underused commands in unix (in that people may use them, but rarely truly exercise what they can do).
Although find and xargs are pretty good candidates too.
Master those 5 commands, and it is amazing what you can do in a single line.