In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 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 cat command 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.
Note: after the awk command, there are not many complex commands, all basic commands.
Description:
Cat, the abbreviation of the word concatenate, outputs the contents of the file to stdout. When associated with the redirection operator (> or
When used in combination, it is generally used to connect multiple files.
Usage:
1. $cat file1 file2 file3
two。 It can be read not only from the file and spliced, but also from the standard input stream.
For example: $echo 'some content' | cat-file.txt
Explanation: here-represents the temporary file of 'some content', that is, the input stream
Example:
1. $cat cat.txt
Printed all the contents of cat.txt
2.$cat cat.txt | less
Check cat.txt, one page and one screen after joining less, which will be described in the less,more command later.
3.$cat-n cat.txt
Mark the line number before each line, including blank lines
4.$cat-b cat.txt
Mark the line number before a non-blank line
Interpretation-- help
Usage: cat [option]. [file].
Output [file] or standard input combination to standard output.
-A,-- show-all equals-vET
-b,-- number-nonblank to the non-empty outgoing line number
-e equals-vE
-E,-- show-ends displays "$" at the end of each line
-n,-- number numbers all lines of the output
-s,-- squeeze-blank does not output multiple blank lines
-t is equivalent to-vT
-T,-- show-tabs displays tabbed characters as ^ I.
-u (ignored)
-v,-- show-nonprinting uses ^ and M-references, except for LFD and TAB
-- help displays this help and exits
-- version displays version information and exits
If no file is specified, or if the file is "-", it is read from standard input.
Example:
Cat f-g outputs the content of f first, then the content of standard input, and finally the content of g.
Cat copies the contents of standard input to standard output.
Interpretation:
1. Cat-s file.txt
If there is a file that has this format:
Line1
# blank line
Line2 file2
Use this command.
Cat is more combined with other commands, and there is no complicated content of its own. If you are bored, try cat-A cat.txt and you will have unforgettable memories.
Related commands:
Cat's father-in-law is usually ordered by sed,tr.
Such as:
$cat file | sed's Compact OldUniverse G'
Display the file file and convert old to new without modifying the original file
Thank you for reading! This is the end of this article on "how to use cat 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.