On Jan 9, 2004, at 6:45 AM, David Ledger wrote: >> 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 '$'. What's the leading $ for? BTW, this is a portable Perl one-liner that does not depend on trailing newlines, and does not slurp the file (it has at most ten lines in memory). I expect it to be slower though: $ perl -ne 'push @x, $_; print shift @x if @x > 10' -- fxn