>From: "Kuestner, Bjoern" <Bjoern.Kuestner at drkw.com> > >> echo '1,$-10p;q' | tr ";" "\n" | ed YOURFILE > >The mystery deepens. (c: > >I kinda feel like my wife right now when she looks at my screen and thinks I >am doing total magic. It may look cryptic, but don't the other solutions look equally so? In the line editor 'ed', '1' means the first line, '$' means the last line, and 'p'means print. Used interactively, entering the print command as '1,$-10p' within 'ed' would print out all lines but the last 10. Entering a 'q' will quit the 'ed' session. Scripting it like this means that you just have to send the same commands to 'ed', it's just that the command sequence contains some embedded newlines. By using ';' instead of a newline, and using 'tr' to convert those ';'s to newlines in stream, I can give a command that won't be corrupted by extra/missing newlines from email (re)formatting that I have no control over. I'm really making the point that often simple tasks can be easily done with the old simple apps like 'ed'. People often loose track of the capabilities of basic apps because they have replaced them in their day to day armoury with 'better' apps. Before 'grep' was written, people used 'ed'. They used 'ed' on the file and entered 'g/xxx/p' - globally, for all lines that match the regular expression 'xxx', print. Or g/Regular Expression/print. This was known as a "grep", but it was done within 'ed'. Hence the name for grep when it was written. David -- David Ledger - Freelance Unix Sysadmin in the UK. Chair of HPUX SysAdmin SIG of hpUG technical user group (www.hpug.org.uk) dledger at ivdcs.co.uk (also dledger at ivdcs.demon.co.uk) www.ivdcs.co.uk