Sed examples
# Print lines from line which match pattern to end of file
pattern=""
sed -n "/$pattern/,$ p" file.txt
# Example
pattern="mnop"
str="$(echo -e "abcd\nefgh\nijkl\nmnop\nqrst\nuvw\nxyz" | sed -n "/$pattern/,$ p")"
echo $str
# Remove lines before line LINE including LINE
sed '1,/LINE/d' file.txt
# Sed append after expr
sed -i "/PATTERN/a APPEND_PATTERN ${d}" file.txt
# Sed insert before expr
sed -i '/EXPR/i\
INSERT_THINGS' file.txt
# Sed delete line
sed -i '/PATTERN/d' file.txt
# Grouping and referencing groups (from pass)
# () + \1 \2 ...
sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g'
# Change default kernel in grub
sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=\"Advanced options for Ubuntu\>Ubuntu\, with Linux 4\.10\.0-24-generic\"/g' /etc/default/grub
# Double quote all words in vim
%s/\(\<[a-zA-Z]*\)\(:\)/"\1":/g
# Change to lowercase
%s/\(\<[a-z]*\>\)\(\":\)/\L\1\2/g
# Copy file with new ext by sed
find ./content -name '_index' | sed -e 'p;s/$/\.sk\.md/' | xargs -n2 cp
# Append "dn: " to every odd line
sed '1d; n; s/^/dn: /g'
sed '0~2 s/^/dn: /g'