March 3, 2009

Sed multiple substitution

Posted in Sed at 1:37 pm by alessiodini


It is possible apply a multiple substitution using sed with “-e” option

bash-2.05$ grep trovati 7-2-2008.log | awk ‘{print $9}’
[28]

If i want remove the bracket squares from the output i can use this option:

bash-2.05$ grep trovati 7-2-2008.log | awk ‘{print $9}’ | sed -e s/”\[“//g -e s/”\]”//g
28

It works!