#!/usr/bin/awk -f # # Take my tab-separated Audio-Hijack recording schedule # and generate HTML table rows. # # $7 is a URL to use as an anchor tag for $3, the radio station. # # Brent Chivers 2006 January 15 # # Added a new 4th column, location. BDC 2006/Jul/08 # Added a new 3rd column, application. BDC 2010/May/16 # Added a new 9th column, station schedule URL. # Expect a possible new 10th column, program site URL. # Conditionally make links in columns if URLs are provided. # 1 Day # 2 Time (US Eastern) # 3 Application # 4 Station # 5 Location (State) # 6 Program # 7 Category # 8 Stream URL # 9 Station Schedule URL BEGIN { FS = " " } # tab-separated fields NF == 0 { next } # skip blank lines NR == 1 { printf ("%s%s%s%s%s%s%s\n", $1, $2, $3, $4, $5, $6, $7) } NR > 1 { printf ("%s%s", $1, $2) if ( $8 ~ /http:.*/ ) { printf ("%s", $8, $3) } else { printf ("%s", $3) } if ( $9 ~ /http:.*/ ) { printf ("%s", $9, $4) } else { printf ("%s", $4) } printf ("%s", $5) if ( $10 ~ /http:.*/ ) { printf ("%s", $10, $6) } else { printf ("%s", $6) } printf ("%s\n", $7) }