[sf-lug] I need a quick piece of code..

Rick Moen rick at linuxmafia.com
Wed Dec 30 22:57:07 PST 2009

Quoting John F. Strazzarino (jstrazza at yahoo.com):

> I have a three line text file
> This is a test
> blank line
> 123456
> The last line of the file is a number and I need just that number....

tail -n 1 [filename]

If there's a blank line at the end of the file, though, you'll end up
getting that.

Returning the last _non-blank_ line might be a little more difficult.  ;->

More information about the sf-lug mailing list