I have a file with many rows, and each row has a timestamp at the starting, like
[Thread-3] (21/09/12 06:17:38:672) logged message from code.....
So, I frequently check 2 things from this log file.
- First few rows, that has the global conditions and start time is also given.
- Last few rows, that has the exit status with some other info.
Is there any quick handy single command that could let me display just the first and last few lines of a file?


head and tailworks for you? – warl0ck Sep 21 '12 at 9:40N– Bernhard Feb 28 at 14:36sed(1)expert, but there are ways of stashing stuff away for later use with it. Maybe it pays off to look in there. OTOH, I'd probably whip up a Perl (or whatever) script to do it if used frequently, as I'm more familiar with that. – vonbrand Feb 28 at 14:41