Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 553 Bytes

README.md

File metadata and controls

27 lines (19 loc) · 553 Bytes

README

Demonstrates techniques for using sed to process files.

Examples

This technique can be used for any platform hosting nginx in a container where a port remap to a arbitrary number is required. i.e. CloudRun, Heroku, etc.

# modify the config file
export PORT=9123
# macosx
sed -i .bak "s/listen[ ]*80;/listen $PORT;/g" ./nginx.conf  
# linux
sed -i.bak "s/listen[ ]*80;/listen $PORT;/g" ./nginx.conf  

Removing lines

# delete a matching line
sed "/listen[ ]*80;/d" ./nginx.conf  

Resources

  • cheatsheet sed