Robert Robert - 1 year ago 105
Linux Question

Remove line of text from multiple files in Linux

Is there a simple way to remove the same line of text from a folder full of text documents at the command line?

Answer Source
sed -i.bak '/line of text/d' * 

If your version of sed allows the -i.bak flag (edit in place). If not simply put it in a bash loop:

for file in $(ls *.txt)
    sed '/line of text/d' $file > $file.new_file.txt
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download