Reverse.bash is a Bash shell script that reverses the order of your text file. Simply pass the input and output file paths as argument and it will do the trick. Output file must not already exist or the software warns you and exits.
Reverse.bash is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.
Reverse.bash "infile" "outfile"
Attached File: Reverse.bash (595 B)
Found a bug in Reverse.bash where it wouldn't work with lines that contain spaces. The new version attached below fixes that problem.
I've made a huge improvement in this version of Reverse.bash by using the "tac" utility to perform the reverse operation. The improved version of Reverse.bash is attached below.
However, some systems (such as Mac OS X) does not have the "tac" utility. In those cases, the previous version of Reverse.bash, with its own reverse algorithm, is still better. In the future, I may modify Reverse.bash to support both methods.
Noticed that the script is calling "sh" rather than BASH. So I made a minor change to call the right shell interpreter.
Did your message disappear? Read the Forums FAQ.
Spam Control | * indicates required field
TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.
No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.
Messages, files, and images copyright by respective owners.
27 Users Online
Copyright © 1996 - 2021. All Rights Reserved.