'ls' question, splitting and files with spaces in their name...

Kevin Cozens kcozens-qazKcTl6WRFWk0Htik3J/w at public.gmane.org
Sat May 22 15:09:30 UTC 2004


At 09:48 AM 05/22/2004, Madison wrote:
>   My problem is that I am just straight splitting on spaces and some 
> files and directory names have spaces in them. I read the 'ls' man page 
> and the closest thing I could find was a switch to add an escape 
> character before the space but that would only be marginally helpful.
>
>   What I need is some way to show the file or directory name with some 
> other character instead of a space so that the first split will leave the 
> file or directory name intact wherein after I could substitute the space back.

Seems simple to handle. Tell the 'ls' command to add the escape for 
filenames/dirs containing spaces. Change the escaped space to the three 
chars %20, split on spaces, then change "%20" back to either a single space 
or an escaped space.


Cheers!

Kevin.  (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172        |"What are we going to do today, Borg?"
E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus:
Packet:ve3syb-XXPEJ3/fxIc at public.gmane.org#con.on.ca.na|  Try to assimilate the world!"
#include <disclaimer/favourite>   |              -Pinkutus & the Borg

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list