LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sed to remove specific lines in a file (https://www.linuxquestions.org/questions/linux-newbie-8/sed-to-remove-specific-lines-in-a-file-727637/)

tekmann33 05-21-2009 03:27 PM

sed to remove specific lines in a file
 
I have a large file whose contents looks like this:

fkjdls;a
fdjksa;||
fdjksa;|fjkd;as|
fjdk;
fdjka;jfdsa||
fjkd;a|fjkd;saj|
fjkd;l

I want to only remove the lines that contain the double pipes that are together '||'.

Would I use 'sed' for this?

Any input would be appreciated.

david1941 05-21-2009 03:33 PM

Grep should work: grep -v '||' largefilename >notsolargefilename


Dave

Tinkster 05-21-2009 03:35 PM

Yes you would =)

sed -i '/||/d' file


Cheers,
Tink

cam34 05-21-2009 03:41 PM

Or grep works too.....
grep -v \|\|


All times are GMT -5. The time now is 11:59 PM.