Wednesday, October 8, 2008

Bits from today

More "sed" powers:
sqlcmd somecommand | sed '1,2d; /^$/ d; /^\(.* rows affected\)/ d; s/ *$//'
That'll delete the first two lines, delete empty lines, delete "rows affected" lines, and trim out ending whitespace! And from vim:
:sort u
Sort and keep only unique lines. Beautimus!

No comments: