Monday, 16 September 2013
Two Ways To Print Lines From File Reversely
Ever tried to print lines in files in the reverse order? You will know two simple methods to print lines from file in the reverse order.
Imagine a file somefile.txt with content something like this:
You can achieve the same effect through other techniques as well but I'll stick to these simple ones :)
Imagine a file somefile.txt with content something like this:
a
b
c
d
e
b
c
d
e
Method 1:
$ tac somefile.txt
e
d
c
b
a
e
d
c
b
a
Method 2:
$ sort -r somefile.txt
e
d
c
b
a
e
d
c
b
a
You can achieve the same effect through other techniques as well but I'll stick to these simple ones :)
Bookmark this post:blogger tutorials
Social Bookmarking Blogger Widget |
Two Ways To Print Lines From File Reversely
2013-09-16T18:23:00+05:45
Cool Samar
bash|centos|linux|linuxmint|tricks and tips|ubuntu|
Subscribe to:
Post Comments (Atom)