[X-Unix] Remove last ten lines of files

David Ledger dledger at ivdcs.demon.co.uk
Thu Jan 8 21:45:24 PST 2004


>From: Eugene Lee <list-themacintoshguy at fsck.net>
>On Wed, Jan 07, 2004 at 08:48:30AM +0100, Kuestner, Bjoern wrote:
>:
>: > 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.
>
>Or shorten the command to:
>
>	echo $'1,$-10p\nq' | ed YOURFILE

Unfortunately, this is shell dependent.  Some shells put out 
backslash n for single quoted '\n'.  Works in Apple's bash and ksh 
built for OSX.  ksh doesn't need the leading '$'.

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



More information about the X-Unix mailing list