![]() |
|
|
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 |
| Find and Replace | NycUnxer | UNIX for Dummies Questions & Answers | 4 | 03-06-2008 12:20 AM |
| find and replace | rakshit | Shell Programming and Scripting | 4 | 01-24-2008 03:52 AM |
| find and replace | mahabunta | UNIX for Dummies Questions & Answers | 7 | 09-21-2006 01:05 PM |
| find and replace | ram2s2001 | Shell Programming and Scripting | 2 | 12-05-2005 02:46 AM |
| Find & Replace | gagansharma | Shell Programming and Scripting | 3 | 11-27-2001 04:17 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
To find and replace paths consisting \
Hi all,
I am new to unix and wanted to replace the string consisting \ with nothing. I tried the following but did not help. for y in `ls DIV*`; do sed s/C:\\Project\\AML\\bin//g $y > temp mv temp $y done I actually want to remove any occurance of C:\Project\ABC\bin in the files. Thanks & Regards |
|
||||
|
Quote:
Quote:
![]() Anyway, all wisecracks aside, you're actually pretty close. Here's your solution: Code:
for y in `ls DIV*`
do
temp=`echo $y | sed -e 's/C:\\Project\\AML\\bin//g'`
mv $temp $y
done
|
|
||||
|
mschwage
Thanks a lot!! works as expected ![]() however, could you please elaborate on -e option.. -e Script "Uses the Script variable as the editing script. If you are using just one -e flag and no -f flag, the -e flag can be omitted." I do not understand it competely.. Thanks in advance! |
|
||||
|
The -e option isn't necessary here, it's for combining multiple commands.
Quote:
Place the mv command after the loop. Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|