On Sat, Aug 26, 2006 at 09:43:03PM +0300, Aaron Mehl wrote:
> Well I found in the Linux cookbook that the tool I need is sed and was
> able to find a way to cut the pieces I need.
> 
> wrong tools but now a happy camper, sorta.
> 
> I want to the sed script to all the files in a directory.
> sed '1,5d' 425-defs.ly > 425n.ly  

Latest versions of gnu sed borrow a nice syntax from perl for inline
editing:

  sed -i -e '1,5d' 425-defs.ly 

> 
> removed the first 5 lines, which is what I really needed.
> but how do I put this in a script which will apply it to all files in a
> directory?

For your original method it would take a for loop:

  for file in *.ly; do  sed '1,5d' $file > $file.tmp; mv $file.tmp $file; done

But then again you could simply use:

  sed -i -e '1,5d' *.ly 

-- Tzafrir

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to