Rick's Tech Talk

All Tech Talk, Most of the Time

Travel Tips for Consultants And Other Road Warriors

I am headed "on the road" soon. Part of my job involves doing "onsite client work". This means I do installations, configurations, development, even training. It's part of the typical technical consultant's life: visiting the corporate back offices and IT departments across the nation (and for some, around the globe).


Printing Line N

If you're in front of UNIX system, you should have access to sed, the UNIX "stream editor", which has a lot of utility to it. Here's a little idiom that comes in handy every now and then.

% sed -n '16p' file.txt
Not bad for 1/2 hour worth of work!

The string '16p' says "print line 16". So to print any particular line out of a file, use sed -n 'Np' file.txt, where N is the line that you want. And if you want a range of lines, use 'M,Np', where M and N are the starting and ending line numbers in question.



Subscribe to Rick's Tech Talk RSS