In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what are the special symbols of shell. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
1. Shell Special symbol cut command
* any character #
? Any character #
# comment character #
\ escape character #
| | Pipe symbol # |
Commands related to pipes
The function of cut to intercept strings
Cut division, the-d delimiter-f specifies the segment number-c specifies the number of characters
Sort sort,-n sort by number;-r reverse order-t delimiter-kn1/kn1,n2
Wc-l statistics lines-m statistics strings-wl statistics words
Uniq de-duplicates,-c counts the number of rows
Similar to tee and >, the redirection is also displayed on the screen.
Tr substitutes characters, tr' aquiz substitutes bounds, uppercase replaces tr' [a Murz]''[Amurz]'to make all lowercase uppercase, tr' [a]''[A]'or tr' aquifer'A 'turns lowercase an into uppercase A.
Split cut,-b size (default unit byte),-l lines
Example of cut command: the last one can be written as 1-3
2. Sort_wc_uniq command
Sort instance:
Add-n to sort by number; sort-nr 1.txt can be sorted in reverse.
Use-m to count the number of strings
Command wc-w 2.txt to count the words in the 2.txt file, using spaces or blank lines as the standard
Uniq de-duplicates instances: need to sort, then remove duplicates (duplicate)
Use the command: sort 2.txt | uniq,-c to calculate the number of repeats
Output the previous content to the back, sort 2.txt | uniq-c > a.txt, the empty command: > a.txt, empty the a.txt file.
3. Tee_tr_split command
Tee has one more advantage than > to display redirected content immediately.
Tr replacement character example: tr'aquiz substitution banner, replace case tr'[Amurz]'[Amurz]'to make all lowercase uppercase
Split cutting example:
Use the find command to append all the suffixes to the conf file, append it to the a.txt file, and use the > command, missing argument means missing.
Add prefix abc
4. Under the special symbol of shell
Variable prefix,! $combination, which represents the end of the line in the regular
Multiple commands are written on one line, separated by semicolons.
~ user home directory, followed by a regular expression indicating a match
& put it after the command and throw the command in the background
>: redirect the correct to a file; > >: append the previous to the following file; 2 >: 2 > >; & >: output all the wrong and correct to a file
[] one of the specified characters, [0-9], [a-zA-Z], [abc]
| and & &, used between commands; or "
| |: if the previous command is executed successfully, the latter command will not be executed.
&: execute the previous command first and then the following command.
Example:
If the directory specified by-d does not exist, it will not be created. If it exists, the following commands will not be executed, and it will not be created.
This is the end of this article on "what are the special symbols of shell?". 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, please 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.