The command is as follows:
1. Sed-n' 1 ~ 2! P'datafile
This command reads the datafile file to the mode space on each two lines, matches the first line in each two lines without printing, and prints the remaining lines to cancel the default output.
2. Sed-n' 1 ~ 2 P 'datafile
This command reads the datafile file to the mode space on each two lines, matches the first line in each two lines, prints the data, and does not print the remaining lines. The default output is canceled.
3. Sed '1 ~ 2d 'datafile
This command is equivalent to the first command.
Appendix: Explanations of SED command manual in Linux
First ~ Step
Match every step 'th line starting with line
First. For example, ''sed-N 1 ~ 2 P ''will print
All the odd-numbered lines in the input stream,
And the address 2 ~ 5 will match every th line,
Starting with the second. First can be zero; in
This case, sed operates as if it were equal
Step. (This is an extension .)