Skip to content

Instantly share code, notes, and snippets.

@vpolimenov
Created May 19, 2022 10:11
Show Gist options
  • Save vpolimenov/d1eda4e8114af2aa0023a692c975ac55 to your computer and use it in GitHub Desktop.
Save vpolimenov/d1eda4e8114af2aa0023a692c975ac55 to your computer and use it in GitHub Desktop.
Update /etc/hosts
#!/bin/bash
# put a command > /tmp/file_to_read.txt
sudo sed -i '/# start here/,/# stop here/d' /etc/hosts
sudo awk '/# start here/{print;flag=1;next}/# stop here/{print;flag=0}flag' /tmp/file_to_read.txt >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment