Skip to content

Instantly share code, notes, and snippets.

@kvaps
Created December 28, 2021 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvaps/7ab0e6b6eb82af1c07b9f63e251233a8 to your computer and use it in GitHub Desktop.
Save kvaps/7ab0e6b6eb82af1c07b9f63e251233a8 to your computer and use it in GitHub Desktop.
Oneliner to replace indents with nindents in Helm chart
grep -rnoP '(?<= indent )[0-9]+' > /tmp/11
cat /tmp/11 | awk -F: '{print $1 " " $2 " " $3}' | while read file line indent; do echo "file=$file line=$line indent=$indent"; sed -i -e "$line s/^ *{{-\?/$(printf '%0.s ' $(seq 1 $indent)){{-/" -e "$line s/ indent \([0-9]\+\)/ nindent \1/g " $file; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment