Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
  line = $0
  while (match(line, /^(.*)spacing\(([0-9\.]+)\)(.*)$/, groups)) {
    line = groups[1] "SPACING(" (groups[2] * 2) ")" groups[3]
  }
  gsub(/SPACING/, "spacing", line)
  print line
}
@markbrown4

This comment has been minimized.

Copy link

markbrown4 commented Mar 16, 2018

Amazing! Thanks :)

This works for executing it on all .scss files in the current directory.

find ./ -type f -name "*.scss" | xargs gawk -i inplace '{                                                          
  line = $0
  while (match(line, /^(.*)spacing\(([0-9\.]+)\)(.*)$/, groups)) {
    line = groups[1] "SPACING(" (groups[2] * 2) ")" groups[3]
  }
  gsub(/SPACING/, "spacing", line)
  print line
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.