[Nottingham] simple question?

Graeme Fowler graeme at graemef.net
Wed Oct 25 11:00:31 BST 2006


On 25/10/2006 10:55, Martin Garton wrote:
> I'm sure this should be trivially simple and I should already know the
> answer, but what's an easy way to reverse the order of the lines in a
> text file with a filter command?  (preferably without involving perl)

To switch lines

1
2
3

to be

3
2
1

use 'tac'

To switch characters in every line such that the "following text" 
becomes "txet gniwollof", use 'rev'

Never used either, but found 'em using "man -k reverse" on an FC4 box.

Graeme



More information about the Nottingham mailing list