User Tools

Site Tools


Sidebar

Computer Science

Germany

Others

Links

computer_science:software:linux:commands:remove_all_lines_of_a_text_file_except_the_ones_containing_a_keyword

Delete all lines except the ones containing the word 'word' in the file 'filename'

sed '/word/!d' filename.txt

Delete all lines except the ones containing the word 'word' or the word 'word2' in the file filename

sed '/word\|word2/!d' filename.txt
computer_science/software/linux/commands/remove_all_lines_of_a_text_file_except_the_ones_containing_a_keyword.txt · Last modified: 2015/03/12 10:39 by thomas