Last active
June 21, 2016 07:04
-
-
Save krasnobaev/9bfb4da0b3b9cb846d974e6c26805a38 to your computer and use it in GitHub Desktop.
MacOS sed patterns
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
# MacOS sed patterns difference – http://unix.stackexchange.com/a/131940/58019 | |
sed /pattern/,+2d # like `sed '/pattern/{N;N;d;}'` | |
sed -n 0~3p # like `awk NR%3==0` | |
sed /pattern/Q # like `awk '/pattern/{exit}1'` or `sed -n '/pattern/,$!p'` | |
sed 's/\b./\u&/g' # \u converts the next character to uppercase | |
sed 's/^./\l&/' # \l converts the next character to lowercase | |
sed -i '1ecat file_to_prepend' file # e executes a shell command | |
sed -n l0 # 0 disables wrapping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment