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

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Sat May 22 15:14:12 UTC 2004


Kevin Cozens wrote:
> 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!

   Yep, that would have worked perfectly, too. Darn, from no good ideas 
to two in a TLUG minute... :p

Madison

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