Home > Net >  Linux - delete lines containing ":\r\n"
Linux - delete lines containing ":\r\n"

Time:08-22

I'm looking for a command to delete lines where ":\r\n" is found. For example from:

test1:
test2:true
tool3:
tool4:false

to:

test2:true
tool4:false

I'm not used to sed very much I tried:

sed '/:\r\n/d' doesn't work

sed '/test1/d' works for this line

CodePudding user response:

Instead of trying to match the newline character, you could match the EOL character, represented by $:

sed '/:$/d' file.txt
  • Related