Command usage: Displays the contents of 20 to 30 lines of the file
-------------------------------------------------
Seq
Generating sequences
SEQ >[file name] Generates a sequence of 1~100 rows:
1
2
3
...
100
Note:
The sequence starts at 1 only when the maximum value is defined above
SEQ 0 100 starts from 0, sequence order follows natural number order
Seq-1 100 starting from-1:-1 0 1 ... 100
-------------------------------------------------
Sed
Stream Editor Stream editors
Sed-n ' 20,30p ' [file name] prints 20 to 30 lines of content in a file
Note:
CENTOS6, Print command character P in citation: Sed-n ' 20,30 ' p [file name]
--------------------------------------------------
Awk
Line processor
awk ' nr>19&&nr<31 ' [file name] displays 20 to 30 rows
awk ' nr==30 ' [file name] shows line 30th
Note: ' = = ' judgment equals, ' = ' is assigned
--------------------------------------------------
Grep
Filter commands
Filter commands can also be used to filter
Extended review:
grep 20-a [file name] Filters the 20th line of the printed file and displays 20 rows after 10 lines (total 11 lines)
grep 30-b [file name] Filters the 30th line of the printed file and displays the first 10 rows of 30 rows (total 11 lines)
grep 25-c 5 [file name] filters the 55th line of the printed file and displays 5 lines (11 rows) before and after 25 lines
--------------------------------------------------
Head tail
Filter commands
Extended review:
head-30 [The results of the first 30 rows of the file name]|tail-11 print files pass through the channel to the tail command, print the end 11 lines
Linux Learning Note 7_ Basic command review 2 (seq sed awk)