The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

tail -n +3 *.tec > .. then what? by Control2006-07-12 08:43:43
  By not doing that by hobbs 2006-07-12 08:49:35
First off, if you give tail a glob, it's going to print out (some portion of) the contents of each file, all to the same output. Not useful. Second, if you do "something filename > filename", the first thing sh does will be to open filename for writing, destroying its contents before "something" can read it. Not useful either.


for x in *.tec ; do
  tail -n +3 $x > tmpfile
  mv tmpfile $x
done
(this has a few issues with filenames with whitespace, but so does your original so I don't feel bad. We'll just assume that's not a problem ;)

[ Reply ]
    Details by hobbs2006-07-12 08:52:13
    Thank you! by Control2006-07-12 08:57:09

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)