I want to take a file that has a series of "#" commented lines then tab delimited content. What I would like to do is use regular expression and perl to input the datafile and output only the USGS line in csv format with no blank lines. I fount a nice regex that changes the file to csv but having issues isolating that single USGS line. Thank you!
perl -lpe 's/"/""/g; s/^|$/"/g; s/\t/","/g' < getme.txt > output.csv
Example content :
*full datafile attached
# DD parameter Description
# 01 00060 Discharge, cubic feet per second
# 02 00065 Gage height, feet
# Data-value qualification codes included in this output:
# P Provisional data subject to revision.
agency_cd site_no datetime tz_cd 01_00060 01_00060_cd 02_00065 02_00065_cd
5s 15s 20d 6s 14n 10s 14n 10s
USGS 01417000 2013-04-06 09:45 EST 80 P 2.95 P