"Linux operations are applied disciplines, and more will result."
View only the contents of line 20th to 30th within the Test.txt file (50 rows)
Setting up an experimental environment
[email protected] ~]# seq >test.txt
[email protected] ~]# cat Test.txt
Method One:
[Email protected] ~]# head-30 test.txt|tail-11
Method Two:
The SED stream Editor enables the file to be added, deleted, changed, replaced, checked
[[email protected] ~]# sed-n ' 20,30 ' P test.txt
Method Three:
AWK Filter Output content processing log text nr denotes line number
[[email protected] ~]# awk ' 19<nr && nr<31 ' test.txt
View the contents of line 10th
[Email protected] ~]# awk ' nr==10 ' test.txt
Method Four:
Filtering with grep
grep 20-a-N test.txt in addition to matching 20 of this line and displays the next n rows
grep 30-b -n test.txt , in addition to matching 30, displays the first n rows
grep 25-c-N test.txt , in addition to matching the 30 line, displays the front and back n rows
[Email protected] ~]# grep 20-a test.txt
[Email protected] ~]# grep 30-b test.txt
[[email protected] ~]# grep 25-c 5 test.txt
Seq Sequence
[email protected] ~]# seq
[[email protected] ~]# SEQ 5
[[email protected] ~]# seq 10-2 0
[email protected] ~]# seq 2
1-10 writing across the
Replace all the characters in the/ZMG directory and its subdirectories that contain Xinwanjia with the name of the. sh extension as Xwj
sed [-i] ' s#a#b#g ' A is the replacement of the content, B is replaced by the content, the parameter I will modify the contents of the file, and vice versa will not fix a content
Zhangminghui-linux Basic Command Learning-3