In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to use the tac and rev commands in linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Description:
Tac and rev are not necessarily related, the only thing they have in common is that they are villains. Tac is actually the reverse of cat, cat normal output, then tac output backwards, but from the last line of output, what about rev? Rev is output in reverse order from the last letter to the first letter of each line.
Simple example
Tac command
File filtering, segmentation and merging
The tac command is used to output the reverse order of the behavioral units of the file, that is, the first line is displayed last and the last line is displayed first.
Grammar
Tac (option) (parameter)
Option
-an or-- append: appends the content to the end of the file
-I or-- ignore-interrupts: ignore the interrupt signal.
Parameters.
File list: specifies the list of files to save content.
Tac tac.txt
The tac help document will be output from the last line
Tac help documents output backwards from line to line, but from the first line to the last line
View the help documentation:
Tac help
Usage: tac [option]. [file].
Reverses each specified file by line and writes to standard output.
If no file is specified, or if the file is "-", the data is read from standard input.
The parameters that must be used for long options are also required for short options.
-b,-- before adds a separation mark before the line instead of at the end of the line
-r,-- regex parses the delimiter as a regular expression
-s,-- the separator= string uses the specified string instead of a newline as a separator
-- help displays this help and exits
-- version displays version information and exits
Rev
The rev command outputs each line in the file in reverse order in characters, that is, the first character is output last, the last character is output first, and so on.
Grammar
Rev (parameter)
Parameters.
File: specifies the file to display the contents 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 21:25:15 2013*filter:INPUT DROP [48113V2690676]: FORWARD accept [0:0]: OUTPUT ACCEPT [3381959Vera 1818595115]-An INPUT-I lo-j ACCEPT-An INPUT-p tcp-m tcp-- dport 22-j ACCEPT-An INPUT-p tcp-m tcp-- dport 80-j ACCEPT-An INPUT-m state-- state RELATED ESTABLISHED-j ACCEPT-An INPUT-p icmp-j ACCEPT-An OUTPUT-o lo-j ACCEPTCOMMIT# 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 retlif* [PORD TUPNI:] 0:0 [TPECCA DRAWROF:] 0:0 [TPECCA DRAWROF:] 51159581833 [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-TIMMOC3102 51:52:12 62 ceD uhT no detelpmoC # Thank you for reading! This is the end of the article on "how to use tac and rev commands in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.