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]
--------------------------------------------
|