LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   using cut command (https://www.linuxquestions.org/questions/linux-newbie-8/using-cut-command-861840/)

dinakumar12 02-10-2011 09:17 AM

using cut command
 
Hi all,

Assume that i am having a text file in my server, and it is wirtten like this

India
America
Japan
china

Hot to use cut command to echo the last value i.e.china in this case.

The values keep on increasing but i want only the last value every time.

How to acheive this, your suggestions would be very helpful.

Thanks in advance,
Dinesh.

macemoneta 02-10-2011 09:18 AM

Use 'tail -n1' not cut.

bsat 02-11-2011 05:26 AM

"cut" is useful when you are dealing with columns of data, in your case as pointed out by the previous post "tail" would be an easier option.

dinakumar12 02-11-2011 06:11 AM

Hi,

Thanks that works.


All times are GMT -5. The time now is 10:56 AM.