To subtitute 'little' with 'big' and 'lamb' with 'cow' in "Mary had a little lamb" we can use:
$ echo 'Mary had a little lamb' | sed -e 's/little/big/' -e 's/lamb/cow/'where -e is for expression flag, 's/little/big/' is the first expression and 's/lamb/cow/' is the second expression
Mary had a big cow
That's all.
between sed and awk which one is easier to use?
ReplyDeleteNeed your advise. Tq
Hi Anonymous,
ReplyDeleteIn my opinion, sed is easier to understand because it follows some command that being used in vi, like the 's' for subtitute