[X-Unix] Remove last ten lines of files

David Ledger dledger at ivdcs.demon.co.uk
Fri Jan 9 12:16:59 PST 2004


>From: Xavier Noria <fxn at hashref.com>
>On Jan 9, 2004, at 6:45 AM, David Ledger wrote:
>>>  From: Eugene Lee <list-themacintoshguy at fsck.net>
>>>  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 '$'.
>
>What's the leading $ for?

Without the '$' the '\n' gets echo'd as a '\' and an 'n' rather than 
a newline.  This is a bash special.

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