I have a file whose first two lines look like this:
"price" "spec.long" "spec.short" "com.long" "com.short" "small.long" "small.short"
"1" 10.8 10270 -4069 57894 -76045 58818 -46868
I’d like to eliminate the first line, eliminate the entire column within quotes, eliminate the quotes and have the result appear as follows:
10.8 1:10270 2:-4069 3:57894 4:-76045 5:58818 6:-46868
I’m considering if it’s worth learning awk to do tasks like this and similar ones. Or if my time is better spent solving this in perl, ruby or python.
The simplest way to get rid of the first line is just grep it out. Then the rest can be hardcoded, assuming the whole file looks like this.
grep -v price file | awk '{print $2 " 1:" $3 " 2:" $4 " 3:" $5 "4:" $6 " 5:" $7 " 6:" $8}'