Tuesday, October 12, 2010

Sh note: reversing a file or a line

rev can be used to reverse a line character by character
tac can be used to reverse a file line by line
these two commands are sometimes handy

sh$ rev
abc
cba

sh$ tac
a
b
c^D
c
b
a

echo abcde | rev

a particular context I used tac
ls /corpora/extra/nivre/corpus/conll-x/data/turkish/metu_sabanci/*/*.conll | cut -d '/' -f8-11 | tac

No comments: