One day a shell command Linux text Operation series-tac,rev command detailed _linux Shell

Source: Internet
Author: User
Tags iptables

Description

TAC and Rev are not necessarily connected, the only same is that they are "villains". TAC is actually cat's reverse write, cat normal output, the TAC is inverted output, but the last line from the line output, that Rev? Rev is the last letter of each line to the reverse output of the first letter.

Simple example

TAC command

File filtering segmentation and merging

The TAC command is used to output the reverse sequence of a file's behavior units, that is, the first line is last displayed, and the last line is displayed first.

Grammar

TAC (options) (parameters)

Options

-A or--append: appends the content to the end of the file;
-I or--ignore-interrupts: Ignore interrupt signal.

Parameters


File list: Specifies the list of files to save the content to.

TAC Tac.txt

The TAC help document will be output from the last line

The TAC help document outputs backwards per line, but from the first line to the last row

To view the Help documentation:

TAC Help

Usage: TAC [options] ... [File] ...
Each specified file is inverted by line and written to standard output.
If you do not specify a file, or if the file is "-", the data is read from standard input.

Parameters that must be used for long options are also required for short options.
-B,--before add a separator flag before and after a row
-R,--regex the delimited flag as a regular expression to parse
-S, the--separator= string uses the specified string instead of a newline as the separator flag
--HELP displays this help information and exits
--version display version information and exit

Rev

The Rev command reverse the output of each line in a file in characters, that is, the first character is last exported, the last character is first exported, and so on.

Grammar

Rev (parameter)

Parameters

File: Specifies the file to display the content in reverse order.

Instance Rev Help

Usage:rev [Options] [File ...]

Options:
-V,--version output version information and exit
-H,--help display this help and exit

 [root@localhost ~]# cat Iptables.bak # generated by Iptables-save v1.3.5 on Thu Dec 26 2 1: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 --stat E related,established-j accept-a input-p icmp-j accept-a output-o lo-j ACCEPT COMMIT # Completed on Thu Dec 26 21:2
5:15 2013 [root@localhost ~]# Rev. Iptables.bak 3102 51:52:12, UhT no 5.3.1v ceD yb EVAS-SELBATPI # Detareneg  ]6760962:31184[pord tupni:]0:0[tpecca drawrof:]5115958181:9591833[tpecca tuptuo:tpecca j-ol i-tupni A-tpecca j- tropd--pct m-pct p-tupni a-tpecca j-08 tropd--pct m-pct p-tupni a-tpecca j-dehsilbatse,detaler etats--ETA  
TS m-tupni a-tpecca j-pmci p-tupni a-tpecca j-ol o-tuptuo a-timmoc 3102 51:52:12 uhT no CeD # 

These two commands are simpler and are written together. A simple command like this later may not be written again. Because a friend asked, the basic orders of things, intend to pen, and a little uninteresting feeling.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.