LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-14-2007, 06:01 PM   #1
lothario
Member
 
Registered: Apr 2004
Posts: 340

Rep: Reputation: 30
Just turn the file upside down.


I have text files with thousands of lines of data.

I want to reverse the contents of a file.

So if the file "A" contains:
Quote:
This is the first line.
This be line 2.
Ah ha, line 3.
The last line goes here.
I would like file "A" to contain:
Quote:
The last line goes here.
Ah ha, line 3.
This be line 2.
This is the first line.
So it not any kind of sort order.
Just turn the file upside down.

Is there a shell command that can do this?
 
Old 09-14-2007, 06:22 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Yes, it's called "tac" which is cat backwards.
It is supplied by the coreutils package which you should have installed.
 
Old 09-14-2007, 06:37 PM   #3
lothario
Member
 
Registered: Apr 2004
Posts: 340

Original Poster
Rep: Reputation: 30
Thanks.
Exactly what I needed.
 
  


Reply


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
CVS upside down rojak Linux - Software 0 06-15-2006 06:05 PM
lpr pdf printing (even pages upside down) Vismat Linux - General 1 01-26-2006 02:51 PM
my mplayer shows everythin upside down.help meout amolgupta Linux - Software 1 07-28-2005 07:33 AM
movies playing upside down in mplayer but fine in totem mickyg Linux - Software 2 10-29-2004 03:01 PM
MPlayer videos upside down! GTBlackwell Linux - Software 4 10-09-2003 06:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:44 PM.

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