/etc/profile
/etc/bashrc, variables are added to the shell environment and are permanently active.
/root/.bashrc
/root/.bash_profile
Regular expressions
Definition: a regular is a way to describe a character or string by combining symbols with special meanings, called regular expressions. (explained by the Order)
Three types of text processing tools/commands: grep sed awk
grep (filter)
Parameters
-n: Show Line numbers
-o: Show only matching content
-q: Silent mode, No output, you have to use $? to determine the success of the execution, that is, there is no filtering to the desired content
-l: if the match succeeds, only the file name is printed, the failure is not printed, USUALLY-RL together,
Grep-rl ' Root '/etc
-a: if the match succeeds, print the matching row and its subsequent n rows (commonly used for log files)
-b: if the match succeeds, the matching row and its first n rows are printed together
-c: if the match succeeds, the matching row and its n rows are printed together
-c: if the match succeeds, the number of rows to match is printed
-e: equals egrep, Extended
GREP-E = Egrep
-i: Ignore case, Direct output to search filter file
-v: inverse, mismatch
-w: matches the word consecutive letters, meets a space as a word processing
The regular introduction
^ Line beginning with * * * to filter lines (* for any Text)
End of line filter line ending with * * (* for any Text)
. Any single character other than the line break
* The preceding characters have 0 or infinitely
. * All Characters
[] any character within the character group \ denotes escape character, while-intelligence is placed at the beginning or end
[^] reverse each character within a character group (does not match each character in a group of Characters)
^[^] lines that begin with characters within a non-character group
[a-z] Lowercase Letter
[a-z] Capital Letters
[a-z] Lowercase and uppercase letters
[0-9] number
\< Word Header words are usually separated by spaces or special characters, consecutive strings are treated as words
\> Word tail
-v to filter out the files that need to be rejected.
Sed
Definition: Stream Editor Stream editer, which is a handler for the behavior unit
-n: Silent mode, No print output
-e: Specify extension rules
-i: making changes to files
-f: write ' rules to file
1. positioning: sed ' 3 ' test
2, d Delete sed ' 3d ' test: Delete line 3rd
3, p copy sed ' 3p ' test: print third line, (re-copy Output)
4, c change sed ' 3c ' 11111111 test: change the file on the third row
5, a append sed ' 3a ' 11111111 test: append files after the third line
6, i insert sed ' 3i ' 1111111 test: insert a row of files before the third Line.
Regular location and then the Write-only command is not positioned, All files are located within
Sed '/regular expression/command ' test
1, sed '/^root/d ' Test delete root this line;
Sed ' 1,3d ' test deletes 1 to 3 rows;
Sed ' 1d;3d ' test to delete the first and third rows
2, s command replace what to change what thing command: sed '///s ' file
Sed ' s/cd/234/' a.txt line matches to multiple, default only one
Sed ' s/cd/234/g ' a.txt line matches to multiple replacements
() to expand the code into a single whole
Sed-r extension regular, (default use!!!) )
Sed-r '/^[0-9] ([a-z]{3) xsb$/s/sb/sb/g ' a.txt backwards and forwards from behind to understand
Replace the first word in the first line
Sed-r ' s/^ ([a-z]+) ([^a-z]+)/\1 \2/g ' test
1 Word symbols take the second part of the first part
Remove the Last Word
Sed-r ' s/([^a-z]) ([a-z]+) $/\1/g ' test
Two word swap locations
Sed-r ' s/^ ([a-z]+) ([^a-z]+) ([a-z]+] ([^a-z]+)/\3\2\1\4/g ' test
Python full stack Linux base (partial) regular expression grep sed