↧
Answer by DG for How can I reverse the order of lines in a file?
Try the following command:grep -n "" myfile.txt | sort -r -n | gawk -F : "{ print $2 }"
View ArticleAnswer by ephemient for How can I reverse the order of lines in a file?
There's the well-known sed tricks:# reverse order of lines (emulates "tac")# bug/feature in HHsed v1.5 causes blank lines to be deletedsed '1!G;h;$!d' # method 1sed -n '1!G;h;$p' # method...
View ArticleAnswer by Mihai Limbășan for How can I reverse the order of lines in a file?
Also worth mentioning: tac (the, ahem, reverse of cat). Part of coreutils.Flipping one file into anothertac a.txt > b.txt
View ArticleAnswer by Jason Cohen for How can I reverse the order of lines in a file?
BSD tail:tail -r myfile.txtReference: FreeBSD, NetBSD, OpenBSD and OS X manual pages.
View ArticleHow can I reverse the order of lines in a file?
I'd like to reverse the order of lines in a text file (or stdin), preserving the contents of each line.So, i.e., starting with:foobarbazI'd like to end up with bazbarfooIs there a standard UNIX...
View ArticleAnswer by user956584 for How can I reverse the order of lines in a file?
For Windows:busybox.exe tac a.txt > reva.txt
View Article