In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Regular expressions
A full stop. / / matches any single character, such as a.. Indicates that the two characters after matching a
^ / / matches the beginning of a line, such as ^ w, which matches the w at the beginning of the line
$/ / matches the end of the line, such as x$ for the line where x is at the end of the line, and ^ insert$ for the line that contains only insert
\ / / the special meaning of removing special characters before special characters
^ $/ / match blank lines
* / / matches 0 or several characters, x* means to match 0 or more consecutive xquotient xxx* means to match one or more consecutive xcenti. * indicates 0 or more characters, and W. progress represents any string that begins and ends with w.
The above characters have special meaning only when used to search for strings, such as / ^ [Amurz] /, which matches lines that begin with uppercase letters
[^ Amurz] / / matches characters except uppercase letters
{min,max\} / / the matching of the specified range. The previous regular expression is repeated at least min times and up to max times
Save the matching string and store the matching string in parentheses to the next register (1-9)
[tT] / / match lowercase or uppercase t
[amurz] / / matches any lowercase letter
[a-zA-Z] / / match lowercase or uppercase letters
[^ character table] / / matches any character that is not in the character table
Cut
Cut-C1-a / / extract the result of each line in a file from the first character to the last character
Cut-C1-5 a / / extract the result of each line in a file from the first character to the fifth character
Cut-d:-F1 / etc/shadow / / extract the result of the first paragraph divided by each line in the shadow file, that is, the user name
Cut-d:-F1 etc/passwd 6 / etc/passwd / / extract each line in the passwd file with the result of the first and sixth paragraphs separated, that is, the user name and the user host directory
Cut-F1 a / / the-d parameter is not added here to indicate the default tab used by cut as the delimiter
\ t / / represents tabs
Paste / / merge lines
Paste-d'+'a b / / merges each line in an and b files, separated by a + sign, and defaults to tabs without adding the-d parameter.
Paste-s a / / merges all lines in file an into one line
Sed / / stream editor for editing data
Sed command file
Sed's Unix intro intro / / replace all the unix in the intro file with UNIX and print it out on the screen without changing the original file (s is the replacement function, g is the global option, ensuring that multiple Unix in one line can be replaced)
Sed-n'1 2p' / etc/passwd / / shows only the first two lines of the passwd file
Sed-n'/ root/p' / etc/passwd / / displays only lines in the passwd file that contain root strings
Sed-n'1 etc/passwd / / Delete lines 1 and 2 from the passwd file
Sed '5d'a / / Delete line 5 of file a
Sed'/ [Tt] est/d' a / / Delete lines in a file that contain Test or test
Sed's _
The last three characters of each line in the sed's file are deleted by the last three characters of the line.
Tr / / is used to convert characters from standard input without changing the original file.
Tr from-chars to-chars
Tr e x < / etc/passwd
Tr'[Amurz]'[Amurz] < / etc/passwd / / convert lowercase letters to uppercase letters in passwd files
Octal values of commonly used ASCII characters
Ring 7
Backspace 10
Tab 11
New line 12
Line wrap 12
Page 14
Enter 15
Escape 33
Tr-s'a / / compress the extra spaces in a file
Tr-d'a / / remove the spaces in a
Tr'X' x' / / all uppercase to lowercase
Tr'()'{}'/ / all left parentheses are converted to opening curly braces, and right parentheses to right braces
Tr'[Amurz]''[N-ZA-M]'/ / all the characters of Amurm are converted to Nmuri Z and then converted to Amurm respectively.
Tr-d'[0-9]'/ / Delete all digits
Grep
Grep pattern files
Grep-I / / is case-insensitive
Grep-v / / inverted, do not display lines that include mode
Grep-l / / displays the file name that contains the schema
Line numbers that match the specified pattern in the grep-n / / file
Sort / / sort, by default, in ascending order of encoding
Sort-u / / remove duplicate lines
Sort-r / / reverse sort
Sort-o / / followed by the file name, and the output is directed to the file
Sort-t:-k 3 / etc/passwd / / sort by user ID
Uniq / / remove consecutive duplicate lines
Uniq input-files out-files
Uniq-d / / shows duplicate lines
Sort / etc/passwd | cut-F1-d: | uniq-d / / find duplicate user names
Awk,perl
Who | cut-F1-d''| grep'\ w\ {4,\}'/ / find a logged-in user with at least 4 characters in the system
Cut-d:-f 1pr 3 / etc/passwd | grep'[0-9]\ {3,\}'| cut-d:-f 1 / / find out users whose user ID number is greater than 99
Cut-d:-f 1Pol 3 / etc/passwd | grep'[0-9]\ {3,\}'| wc-l / / counts the number of users greater than 99
Ls-l | sort-nrk 5 / / list all files in the directory in descending order of file size
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.