Posted to tcl by patthoyts at Wed Sep 20 14:11:10 GMT 2006view pretty
# Sed success|failed counter. # # A foolish sample to see if sed can manage more that one counter. # Initialize our counters 1{ x s/^/S0F0/ x } # Print the result at the end. ${ g p } /success/{ # get counter digit for the success counter g s/S.*\(.\)F.*/\1/ # Increment the hex digit. y/0123456789abcdef/123456789abcdef0/ # Replace the digit in the counter string. x G s/S\(.*\).F\(.*\)\n\(.\)/S\1\3F\2/ x } /failed/{ g s/.*\(.\)/\1/ y/0123456789abcdef/123456789abcdef0/ x G s/.\n\(.\)/\1/ x } # Do not display any lines from the input. d