Search This Blog

Sed: multiple substitutes in one sed command

Delimit commands with semicolon:
echo "John like apples." | sed 's/apple/pear/;s/John/David/'
Another example, remove leading and trailing quotes:
echo "'Sed is cool.'" | sed 's/^'//;s/'$//'

No comments:

Post a Comment