sed delimiter
Hi Guys,
I wonder what is the sed option equivalent to cut delimiter like example below HOSTNAME=XXX I want only XXX ,so for cut command I use. echo "HOSTNAME=XXX" |cut -d "=" -f 2 How can I use sed in this way ? Thank you. |
I'm not sure why you'd want sed there, but
Code:
echo 'hostname=xxx'|sed -e s/hostname=// HTH |
Thank you chrism01!
|
Code:
echo 'hostname=xxx'|sed 's/[^=]*=//' |
Thank you very much gentlemen . The reason is I'm newbie on sed and trying to use it as a powerful stream editor.
Quote:
Thank you. |
Hi kankan55
you can understand the general syntax for sed command sed 's/$unwanted/$wanted/' $file Here s = substitute $unwanted is what you dont require or want to replace. $wanted is what you need insted of unwanted. $file is your input file or u can have a pipe statement. Quote:
|
[^=]*= - zero or more (*) lots of not the equal sign ([^=]) followed by a single equal sign (=)
|
All times are GMT -5. The time now is 11:51 PM. |