简体   繁体   中英

How to get last n number of records from a file using linux

I'm running a command-line utility and it's producing 60 records(CSV) at a time and sleeps for one minute and producing 60 records again and so on.

I can redirect the output in a file but I want only the last 60 records to be saved (overwrite) for every minute.

Please help me to achieve this.

This can easily be done using the tail command.

Although tail -60 exists, I advise you to use tail -n 60 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM