[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Maybe offtopic: Dealing with filenames with blanks in a script



 --- diego <ddc_prueba@yahoo.es> wrote: 

> test 1
> test 2
> test 3
> 
> I want a script to do some processing on them, let's simplify with a
> simple cat:
> 
> for i in `ls *`; do cat $i; done

find . -maxdepth 1 -type f -name '* *' -exec cat '{}' \;

If you need to encapsulate it do:

find . -maxdepth 1 -type f -name '* *' -print | while read foo; do cat
"$foo"; done

HTH,

-- Thomas Adam

=====
"The Linux Weekend Mechanic" -- http://linuxgazette.net
"TAG Editor"                 -- http://linuxgazette.net

"<shrug> We'll just save up your sins, Thomas, and punish 
you for all of them at once when you get better. The 
experience will probably kill you. :)"

 -- Benjamin A. Okopnik (Linux Gazette Technical Editor)


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html



Reply to: