hi,
I have to reverse the command output like below:
output:
online
offline
disable
maintening
killed
How to reverse this output like:
killed
maintening
disable
offline
online
It should be ksh script.
Thanks very much!
hi,
I have to reverse the command output like below:
output:
online
offline
disable
maintening
killed
How to reverse this output like:
killed
maintening
disable
offline
online
It should be ksh script.
Thanks very much!
Some systems have a command, tac, that does what you want. If not, you can do it with:
awk '{ x = $0 "\n" x } END { printf "%s", x }'
hi,
I have found a way to share, welcome more comments for it.
output | /usr/bin/tail -r
$ printf "%s\n" 1 2 3 4 | tail -r
tail: invalid option -- r
Try `tail --help' for more information.
try this
printf "%s\n" 1 2 3 4 >temp
tail -r temp