#!/usr/bin/awk -f # delicious decided (out of nowhere) to change its tag separator from whitespace to comma, # but since it didn't update it's browser plugin, i ended up with messed up multi-word tags # here's my quick solution to fix that mess : # # 1] export all your delicious tags to a html file e.g. delicious.html # 2] execute the below awk script to the exported file BEGIN{ FS = "=" } { i = 1; while( i <= NF ) { if( $i ~ /TAGS/ ) { printf( "%s%s", $i, FS ) n = split( $(i + 1), a, "\"" ) # the second element of the split array should contain the tags gsub( " ", ",", a[ 2 ] ) # print the comma separated tags printf( "\"%s\"", a[ 2 ] ) # reconstruct the rest of split array along with the split character # do not add the split character after the last element of the array for( j = 3; j <= n; j++ ) { printf( "%s%s", a[ j ], ( j != n ) ? "\"" : "" ) } # skip the next record since we have just processed it i++ } else { # if it's the last field do not use FS printf( "%s%s", $i, ( i != NF ) ? FS : "" ) } i++ } printf( "%s", ORS ) }