![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to replace string | scorp_rahul23 | Shell Programming and Scripting | 4 | 09-22-2008 11:37 PM |
| Search, replace string in file1 with string from (lookup table) file2? | gstuart | Shell Programming and Scripting | 2 | 04-11-2008 11:32 AM |
| replace string in XML with sed | chiru_h | Shell Programming and Scripting | 6 | 04-09-2008 04:49 PM |
| Replace string B depending on occurence of string A | hemangjani | Shell Programming and Scripting | 1 | 12-05-2006 02:10 PM |
| How to replace within a string | aukequist | Shell Programming and Scripting | 2 | 02-07-2006 04:42 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Replace string
Hi
a.txt abc|xyz abc|zyc I want to replace abc with abc1/abc2 using sed I tried with but its not working sed 's/abc/\abc1/abc2\/g' a.txt Thanks, Akil |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
sed 's/abc/abc1\/abc2/' a.txt |
|
#3
|
||||
|
||||
|
try this
Code:
sed 's/abc/abc1\/abc2/g' |
|
#4
|
|||
|
|||
|
Hi
Thanks,Its working Thanks, Akil |
|
#5
|
|||
|
|||
|
sometimes it helps to change the deliminator'
sed 's!abc!abc1\/abc2!' a.txt does not have to be a / !!!!!!!!!!!!!!!!, but you must do a \ to exit the meta char "/" is a meta char,, see google regx sed 's|abc|abc1\/abc2|' a.txt |
|
#6
|
|||
|
|||
|
No, you don't need the backslash if you use a different delimiter.
|
|||
| Google The UNIX and Linux Forums |