Skip to content

Instantly share code, notes, and snippets.

@tkurki
Created February 8, 2014 07:39
Show Gist options
  • Save tkurki/8878068 to your computer and use it in GitHub Desktop.
Save tkurki/8878068 to your computer and use it in GitHub Desktop.
Sed oneliner to convert markup to d3 append/attr commands. Not terribly pretty, but helps with tedious conversions.
cat | sed 's/\<\([a-z]*\)/append("\1")/' | sed 's/ \([a-z]*\)="/.attr("\1","/g' | sed 's/"\.att/"\)\.att/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment