using echo 'text' > file (to add to last line of several documents)

Steve Holmes steve at holmesgrown.com
Wed Oct 27 11:17:03 MST 2010


And sometimes my alias one-liners grow to something more like a short
script and then I have my own bin directory where I stick them; there,
I can expand on them over time into a more powerful and flexible mini
application in some cases.

On Sun, Oct 24, 2010 at 08:34:38AM -0700, Lisa Kachold wrote:
> Let's develop the use of these one-liners a bit further, shall we?
> 
> On Thu, Oct 21, 2010 at 1:20 PM, der.hans <PLUGd at lufthans.com> wrote:
> 
> > 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.
> 
> 
> Anything required to use regularly, might be setup as alias added to your
> own personal .bashrc file:
> 
> alias textphp="/bin/ls *.php | while read i ; do echo "text" >> $i ; done"
> 
> When one has to use repeated commands like anything for which one might
> repeatedly need to use while loops, a .bashrc assists to provide a means of
> ownership of complex technology.
> 
> In some shops it's even allowed to maintain a NFS, CIFS shared /bin with
> scripts and tools submitted and available for use by all engineers,
> administrators?
> 
> 
> >
> >
> > 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 - PLUG-discuss at lists.plug.phoenix.az.us
> > To subscribe, unsubscribe, or to change your mail settings:
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >
> 
> 
> 
> -- 
> Skype: 6022393392
> ATT:     5037544452
> GV:      6236883392
> http://www.it-clowns.com
> Politicians should read science fiction, not westerns and detective stories.
> -Arthur C. Clark I am free because I know that I alone am morally
> responsible for everything I do. -Heinlein

> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss



More information about the PLUG-discuss mailing list