Having a data set like below shown with (:)colon delimeted:
##L1
Advc:start:TA_Wk;TA_Wk:rstb:ver:trstb.techind_C3_D[0].RESETH:LK
##L2
ner:ted:Unused:C1500:ver:sync3rmsfd0nt_t;tape_out:SOCK0
I am using the column number's and I am attaching some strings to it using AWK. And I am trying to ignore the COmments which encounter's with # and appending them at last.
#!/bin/bash
awk -F: '/^#/ {c=$0; sub(/#+/,"", c); next}
{print $1, "-f" " "$4, "-t" " "$6, "-d" " ""{"$3"}", "-t" " ""{"$7"}","-", "\"" c "\""}' s1
Output:
Advc -f rstb -t trstb.techind_C3_D[0].RESETH -d {TA_Wk;TA_Wk} -t {LK} - "L1"
-f -t -c {} -c {} - "L1"
ner -f C1500 -t sync3rmsfd0nt_t;tape_out -d {Unused} -t {SOCK0} - "L2"
Desired Output:
Advc -f rstb -t trstb.techind_C3_D[0].RESETH -d {TA_Wk;TA_Wk} -t {LK} - "L1"
ner -f C1500 -t sync3rmsfd0nt_t;tape_out -d {Unused} -t {SOCK0} - "L2"
1.In column 3 and column 7 if words like are "Unused", "Unspecified" then it should not print that particular column it should ignore along with the string attached to it as shown above in desired output.
2.HOw to remove empty lines.
How to fix above two conditions in my code as shown above?