Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-16-2014, 08:07 AM   #1
Registered: Jun 2013
Posts: 36

Rep: Reputation: Disabled
Extract the last line of files in bulk

How can I extract just the last line of files and save them to other files?

My program created many huge data files. I need to extract just the last line of each and save it to another file. That is, if I have 10 files, I need to extract the last line of each one and save them to 10 new files.

What's the easiest way to do that in Bash Linux?

Old 04-16-2014, 08:11 AM   #2
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,144

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
man tail

maybe put it in a for loop.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sed one line extract between two strings on one line - several occurences Jykke Linux - Desktop 2 12-05-2012 09:08 AM
bash: bulk rename files jocala Linux - General 6 09-29-2012 05:01 AM
rename bulk files scofiled83 Programming 11 06-26-2009 10:16 PM
bulk rename files atiman Linux - Newbie 5 03-05-2009 12:42 AM
Deleting files in bulk through ftp doctorwebbox Linux - Software 2 12-25-2004 12:43 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration