Sed + delete line only if line ended with specific character

sedsolaris

need help – how to delete the line from the file if the last char is – ":" with sed , on Solaris machine

for example sed will remove the following line (include the black line)

      /etc/val/config/globals.xml:/globals/CLUSTERNODES/node:

example what not need to delete

      /etc/val/config/globals.xml:/globals/CLUSTERNODES/node:node1a

Best Answer

sed -e '/:$/d' < foo > foo.new

will do the job (just tested it on Solaris 8, and it seems fine).

Related Topic