The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
escaping / (forward slash) farooqpervaiz Shell Programming and Scripting 1 08-07-2008 03:26 AM
Replace the last slash alone christineida Shell Programming and Scripting 3 07-10-2008 01:07 AM
Help with SED and forward slash gseyforth Shell Programming and Scripting 3 05-26-2008 08:29 AM
awk slash McLan Shell Programming and Scripting 6 04-09-2008 03:00 PM
grep for forward slash wxornot Shell Programming and Scripting 3 02-29-2008 10:01 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-25-2009
mvictorvijayan mvictorvijayan is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 29
Substitute single backward-slash with the double backward-slash

Hi,

I have a path like this c:\test\sample\programs, i need to change thiis to c:\\test\\sample\\programs. How to perform this? I tried tr command but it didn't help me.

Thanks
Vijayan
  #2 (permalink)  
Old 06-25-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
try sed.
  #3 (permalink)  
Old 06-25-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
We need to avoid "echo" because the \t contained in the string becomes a tab!
Try this.


Code:
#!/bin/ksh
print -R "c:\test\sample\programs"|sed -e 's/\\/\\\\/g'

c:\\test\\sample\\programs

  #4 (permalink)  
Old 06-26-2009
mvictorvijayan mvictorvijayan is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 29
Thanks methyl, it works fine.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0