How to remove a value with sed
I have this:
bash-2.03$ echo $pepe
hola adios kkk
I would like this:
I would like remove the first field of the pepe variable, but with a condition, I don't know the value of the fields.
I'm trying with sed but I can't:
bash-2.03$ echo $pepe | sed "s/.*\ \(.*\).*$/var1=\1/"
Could you say me how with sed?
Many thanks and sorry for my english!
If the name of variable ($pepe) and its content
or you have a different content or word to substitute...,
for ex. you want to obtain...
to operate on specific fields--where the content can vary---you are better off with something like AWK.
It CAN be done in SED.....You would have to write a Regex which matches the first group of characters that are NOT spaces, followed by a space. This seems to work, but is probably not the best solution:
sed 's/.[^ ]* //' filename
(The . is there to keep it from failing when there is a leading space.)
Really good tutorial on SED, AWK, and more here: http://www.grymoire.com/Unix/
Is this what you want?
|All times are GMT -5. The time now is 08:24 AM.|