LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sed : how to use delimiter (https://www.linuxquestions.org/questions/linux-newbie-8/sed-how-to-use-delimiter-691190/)

Ashok_mittal 12-17-2008 05:58 AM

sed : how to use delimiter
 
Hi,

i have a file like:


it is for
the format is
...


now my problem is when i give this sed command :

sed 's/for/sfor/g'

it replaces "for" as well as "format" so how to delimit this so that the output should be:

it is sfor
the format is
...

not

it is sfor
the sformat is
...

sycamorex 12-17-2008 06:06 AM

try:
Code:

sed 's/\<for\>/sfor/g'

pixellany 12-17-2008 06:41 AM

Really good SED tutorial here:
http://www.grymoire.com/Unix/Sed.html

Keep in mind that SED is literal---in your example, "for" does not mean the word "for"--it means those three letters in sequence.


All times are GMT -5. The time now is 08:42 PM.