米莱童书-生命简史从宇宙起源到人类文明
天文最爱看的是几次生物大灭绝事件
When you copy a DOS file to Unix, you could find \r\n in the end of each line. This example converts the DOS file format to Unix file format using sed command.
1 | $sed 's/.$//' filename |
Print file content in reverse order
1 | $ sed -n '1!G;h;$p' thegeekstuff.txt |
Add line number for all non-empty-lines in a file
1 | $ sed '/./=' thegeekstuff.txt | sed 'N; s/\n/ /' |
More sed examples: Advanced Sed Substitution Examples