Nelson P Nelson P - 1 year ago 89
Bash Question

How to get the last line of a file using cat command

I am writing a shell script in OSX(unix) environment. I have a file called
with the following content:

gets the following output:

//This file is intended for
//blah blah purposes

command, how can I get only the last line of the file ?

Answer Source

Don't use cat. tail was meant for this usecase exactly:

$ tail -1 ./
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download