LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-Nov-2009, 10:06 AM
SROSeaner's Avatar
Senior Member
 
Join Date: Sep 2007
Posts: 142
SROSeaner 0 reputation points
Default Bash Scripting: Replace space with literal "\ "

I am having a small problem with a bash shell script.

This script dumps a directory listing of files to a single file in the following format:

user/sean/my documents/testdocument.txt
user/sean/my documents/test document2.txt

I want to be able to insert \ in front of every space there is so the path can be properly processed later on as follows:

user/sean/my\ documents/testdocument.txt
user/sean/my\ documents/test\ document2.txt

Any suggestions? I have tried with tr and sed but doesn't seem to put the \[space] in, it just puts a space.
__________________
--------------------------------------------
Sean [CPA|Net+|Linux+|CNA|CNE|CLA|CLP|NCE-ES]
--------------------------------------------
Reply With Quote
 

Thread Tools
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 05:32 PM.


© 2007 Novell, Inc. All Rights Reserved.

Search Engine Friendly URLs by vBSEO 3.3.0 RC2