I was just wondering what command i need to put into the terminal to read a text file, eliminate all lines that do not contain a certain keyword, and then print those lines onto a new file. for example, the keyword is “system”. I want to be able to print all lines that contain system onto a new separate file. Thanks
Share
grepis your friend.For example, you can do:
man grep and you can get additional useful info as well (ex: line numbers, 1+ lines prior, 1+lines after, negation – ie: all lines that do not contain grep, etc…)
If you are running Windows, you can either install cygwin or you can find a win32 binary for grep as well.