I have a file with the following format:
INTEGER INTEGER TEXT
The text is unicode and can have spaces.
I am trying to use awk in order to print the first INTEGER and the TEXT in a file in a specific format using printf.
Problem: because TEXT in some lines has spaces the $3 does not have the complete TEXT so the line is broken in more fields.
Example:
12 42956 Cinema - 3D/Multiplex
7 12560 Status Update
5 184 Movie
My approach for this is the following:
awk '{ c=$3; for(i=4; i< NF;++i){c=c" "$i}; printf "<tag>%d</tag>\n<tag>%s</tag>\n", $1,c}';
But I thought there might be a better approach
/2;?