Ubuntu – Delete all lines containing backslash from text file

command linegrepsedtext processingtext;

I have a file that has content like this:

apple
b\all
cat
\34
egg

I want to remove all lines containing backslashes. I tried using

sed '/\/d' pdataf.txt

But it didn't work. What should I try?

Best Answer

You just have to escape the backslash (escape the escape!)

$ sed '/\\/d' pdataf.txt
apple
cat
egg
Related Question