![]() |
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 required for replacing text in vi | Chandu2u | Shell Programming and Scripting | 6 | 01-26-2008 11:12 AM |
| replacing a nul field with text | DarkHound | Shell Programming and Scripting | 3 | 09-04-2007 03:34 PM |
| Replacing text | chrchcol | Shell Programming and Scripting | 3 | 07-25-2006 01:30 PM |
| replacing text | ajaya | Shell Programming and Scripting | 2 | 04-12-2006 01:31 PM |
| replacing text in an ascii doc | cubs0729 | Shell Programming and Scripting | 6 | 09-29-2005 04:05 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help in replacing text with the value of a variable
Input file - tmp
<begin> ./00003/ ./00004/ <end> I would like to replace "." with the value of pwd so that the output will look like /dev/project/00003/ t=`pwd` sed -e "s/\./$t/g" tmp > tmp1; The above piece of code is not working. Appreciate your help. |
|
||||
|
use this
Quote:
use this set file name as command line arg cat $1 | while read line do grep "./" $1 if [ $? -eq 0 ] then rep=${line/.\//$PWD/} echo $rep >>tmp1 else echo $line >>tmp1 fi done exit 0 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|