![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help needed in fuser command | anju | Shell Programming and Scripting | 1 | 02-20-2008 02:08 AM |
| help needed in ls command | anju | Shell Programming and Scripting | 1 | 02-18-2008 07:20 AM |
| Help needed on Date command | nikunj | Shell Programming and Scripting | 5 | 07-08-2006 11:37 AM |
| Help needed for ps command in AIX | moe2266 | AIX | 0 | 09-30-2005 11:43 AM |
| help needed for sed command | manualvin | UNIX for Dummies Questions & Answers | 2 | 06-24-2004 11:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
SED command ---------help needed
Hi all
I am new babie to shell script, so please advise me n help me . suppose i have a string "abacus sabre", i need to replace occurences 'ab' with 'cd' and i need to store this result into same string and i need to return this result from script to the calling function, where as the string is passed from calling function. i tried like this mainStr="abacus" old_word="ab" new_word="cd" result=`sed -i s/$old_word/$new_word $mainstr ` return $result |
|
|||||
|
Hi
This is the same question you posted in: Need help regarding replacing a part of string Please folow the forum rules and do not multiple post.... however...following examples should help you on your way a little: Code:
# mainstr="abacus sabre" # echo $mainstr abacus sabre # echo $mainstr | sed 's/ab/cd/g' cdacus scdre # echo $mainstr abacus sabre # mainstr=`echo $mainstr | sed 's/ab/cd/g'` # echo $mainstr cdacus scdre |
|
||||
|
mmoutairek,
Please don't hijack another's thread with your unrelated question but start a new thread. Regards |
| Sponsored Links | ||
|
|