TrumanWong

rev

Output the file contents in reverse order of characters

Supplementary instructions

rev command outputs the contents of each line in the file in reverse order of characters, that is, the first character is output last, the last character is output first, and so on.

grammar

rev(parameter)

Parameters

File: Specify the file whose contents are to be displayed in reverse order.

Example

[root@localhost ~]# cat iptables.bak
# Generated by iptables-save v1.3.5 on Thu Dec 26 21:25:15 2013
*filter
:INPUT DROP [48113:2690676]
:FORWARD accept [0:0]
:OUTPUT ACCEPT [3381959:1818595115]
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
COMMIT
# Completed on Thu Dec 26 21:25:15 2013

[root@localhost ~]# rev iptables.bak
3102 51:52:12 62 ceD uhT no 5.3.1v evas-selbatpi yb detareneG #
retlif*
]6760962:31184[ PORD TUPNI:
]0:0[ TPECCA DRAWROF:
]5115958181:9591833[ TPECCA TUPTUO:
  TPECCA j- ol i- TUPNI A-
  TPECCA j- 22 tropd-- pct m- pct p- TUPNI A-
  TPECCA j- 08 tropd-- pct m- pct p- TUPNI A-
  TPECCA j- DEHSILBATSE,DETALER etats-- etats m- TUPNI A-
  TPECCA j- pmci p- TUPNI A-
  TPECCA j- ol o- TUPTUO A-
TIMMOC
3102 51:52:12 62 ceD uhT no detelpmoC #