Skip to content

Instantly share code, notes, and snippets.

@mattolenik
Created September 3, 2018 18:50
Show Gist options
  • Save mattolenik/063cf8fd1187ea0b167e206f4dda1425 to your computer and use it in GitHub Desktop.
Save mattolenik/063cf8fd1187ea0b167e206f4dda1425 to your computer and use it in GitHub Desktop.
Use awk to uncomment specific lines of a file
# Strips n characters from the beginning of the line. This example uncomments a line in /etc/sudoers.
n=3
cat /etc/sudoers | awk '/^# %wheel ALL=\(ALL\) ALL/ {$0=substr($0,$n)} 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment