RE: using echo 'text' > file (to add to last line of several…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
To: Main PLUG discussion list
Subject: RE: using echo 'text' > file (to add to last line of several documents)
Am 21. Oct, 2010 schwätzte Hunter Kreie so:

> Although the for loop will probably work for your PHP files, I generally prefer using a different method for processing lists of files.
>
> /bin/ls *.php | while read i ; do echo "text" >> $i ; done
>
> This will handle files with spaces in them and gives you more flexibility with the input list. For instance, if you have a bunch of subdirectories, you could use find instead.


You're correct, my loop has problems with files that have spaces in the
name.

Your loop is better for a standalone task like this.

ciao,

der.hans
-- 
#  http://www.LuftHans.com/        http://www.LuftHans.com/Classes/
#  "The purpose of IT is to seamlessly and transparently provide the other
#  9/10's of the iceberg for people who need to work with chunks
#  of floating ice." -- Strata Rose Chalup
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss