Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
Please help me in resolving this problem.
I want to use sed command to change the path of file to have '\' along with '/'
for ex:-
echo "/usr/local/chitti/my_space" | sed -n "s/\//\\\//gp"I get
\/usr\/local\/chitti\/my_spaceBut when same added in bash script I get the path as
/usr/local/chitti/my_space
Any help to resolve this will be greatly appreciated.Thanks,
chitti.

This might better be answered in the programming forum,,,, I did a google search on using the sed command and with the way your using it ,, I'm a little unclear as to exactly what it is your trying to accomplish ,,, Perhaps
http://www.ncsa.uiuc.edu/UserInfo/R...
would be able to help somewhat,,,
MSI 845e mb 1 gb ram and a p4 2.4n running fedora 7 xp ,win 2000 advanced server and win 98 SE alot to learn and I know so little !!!!

Do not use double quotes around the sed script, use single quotes like:
echo "/usr/local/chitti/my_space" | sed -n 's/\//\\\//gp'

Syntax will get you every time,,,, Huh,,,!!!
Well Have Fun Huh!!!MSI 845e mb 1 gb ram and a p4 2.4n running xp ,win 2000 advanced server and win 98 SE alot to learn and I know so little !!!!

Thanks I found the other way - using awk
with FS as / and again concatenating all arguments with "\/" this when used in bash script worked perfectly.Thanks,
Chitra
chitti

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |