sed
Match text and backreference
You can match some text with a regex. Put it in parentheses ()
called grouping. This way you put the matched text in a variable \1
sed -rie 's/(hoi).*/\1 blaat/' test1
Remove out commented lines and empty lines. Match all environment variables names defined in .env and replace the rest of the line with this find
egrep -v '^#|^$' ~/repos/docker-project/.env |sed -E 's/(.*)=.*$/\1/'
search
search line in file and replace based on match
sed -e '/CN[-]*EXT/s/^/#/' -i gconv-modules
search line based on regex and delete that line
sed -i 'g/Amsterdam/d'
search line and delete if word Amsterdam is not found.
sed -i 'g!/Amsterdam/d'