Hi everyone
I am new to Unix. I got stuck up by small issue.
I have text file something like this
abc 'xyz' '5'
lmn 'pqr' '7'
i want to replace the abc 'xyz' '5' to abc 'xyz' '6'
but i have a key as 'xyz' based on this key i want to do that.
I am not aware of how to use sed command.
i tried something like this but no luck.
sed 's/'xyz' '5'/'xyz' '6'/g' filename
but it is going to
>
>
Mode
I don't want script.I want to use this in a single command.
Note :Key should be matched with 'xyz' and should replace entire line.
Please help me. its urgent.
In the sed command, quote the single quotes with a reverse solidus.
For example:
sed -e "s/abc \'xyz\' \'5\'/abc \'xyz\' \'6\'/g" filename
The skeleton of this sed is:
sed -e "s/old string/new string/g" filename
The "g" means global i.e. process the whole file.