lundi 15 mai 2017

gawk split on pattern

I am trying to split a string by pattern. The strings looks like this

"Table 4. Kings County" 

"Table 984. Los Angles County" 

Desired array would be

"Table 4","Kings","County"
"Table 984","Los Angles","County" 

I tried something like this

echo "Table 4. Kings County"  | gawk '{patsplit($0,a,/Table [[:digit:]]./s); print a[1]}'

But doesn't really work

Aucun commentaire:

Enregistrer un commentaire