diff --git a/README.md b/README.md index 8da2a1c..bd57e1c 100644 --- a/README.md +++ b/README.md @@ -564,7 +564,7 @@ sed '$a\' ##### Add string to beginning of every line (e.g. 'bbo') ```bash -sed -e 's/^/bbo/' file +sed -e 's/^/bbo/' filename ``` ##### Add string to end of each line (e.g. "}") @@ -577,6 +577,13 @@ sed -e 's/$/\}\]/' filename sed 's/.\{4\}/&\n/g' ``` +##### Add a line after the line that matches the pattern (e.g. add a new line with "world" after the line with "hello") +```bash +sed '/hello*/a world' filename +# hello +# world +``` + ##### Concatenate/combine/join files with a separator and next line (e.g separate by ",") ```bash sed -s '$a,' *.json > all.json