Created
November 22, 2013 02:38
-
-
Save maycat/7593877 to your computer and use it in GitHub Desktop.
sed cookbook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # print the first line | |
| sed -n 1p somefile.txt | |
| sed '1!d' somefile.txt | |
| # print lines 2 to 4 | |
| sed -n 2,4p somefile.txt | |
| sed '2,4!d' somefile.txt | |
| # print lines 1 to 2 and line 4 | |
| sed -n -e 1,2p -e 4p somefile.txt | |
| # References | |
| # | |
| # 1. http://linuxcommando.blogspot.kr/2008/03/using-sed-to-extract-lines-in-text-file.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment