0
I have to do script in AWK, which will choose the longer field in the line and after that in the end show in two line filed and under(in second line) length.
I made this:
NF>0 || $0=="^[[:space:]]{1,}$"{
tab[FNR]=$1
len[FNR]=length($1)
i=2
while (i<=NF)
{
len2=length($i)
if(len2>len[FNR])
{
tab[FNR]=$i
len[FNR]=len2
}
i=i+1
}
print tab[FNR]
}
END{
for(x in tab)
{
printf("%s ",tab[x])
}
for (y in len)
{
printf("%d ", len[y])
}
}
But results: (..) Non-ASCII
Informative Meta-Syntax Transport Fields", Structured Identification 2919, Showalter, Language", "Internationalized Applications August Bernstein, <http://cr.yp.to/proto/verp.txt>. Addresses Levine Taughannock Box Trumansburg, US Phone: standards@taugh.com http://jl.ly Randall Incorporated Morehouse Diego, US rg+ietf@qti.qualcomm.com Informational
11 11 10 13 9 9 8 14 12 9 11 14 6 14 13 11 10 11 11 9 9 11 8 39 9 10 9 8 10 38 11 12 10 10 10 10 13 1 9 8 12 13 9 9 8 8 6 7 8 11 12 14 10 10 11 12 14 12 10 13 17 9 10 13 11 10 8 13 11 13 9 9 14 10 9 9 8 13 12 10 10 13 1 9 13 12 11 10 13 7 12 8 13 16 7 10 8 9 13 12 7 9 9 11 14 11 14 13 11 12 15 9 7 12 9 10 7 11 8 10 11 13 8 14 13 13 1 9 9 8 12 13 20 13 13 11 13 11 9 9 11 10 11 13 9 12 13 11 12 11 13 13 10 12 8 11 8 13 9 10 8 10 12 10 12 13 1 9 8 8 12 16 9 10 11 11 9 12 9 10 11 10 7 10 11 8 8 10 8 9 9 6 9 8 9 11 8 9 10 8 9 9 8 8 9 10 12 10 9 11 13 1 9 7 13 11 8 9 11 10 8 8 25 10 38 17 45 15 43 10 25 11 28 13 49 10 13 10 10 7 7 9 8 10 10 17 10 12 10 12 10 13 1 9 9 8 10 8 10 15 12 7 9 14 8 13 17 9 10 9 8 11 10 9 9 10 15 10 10 10 11 10 11 9 9 10 10 9 10 12 8 11 14 11 9 9 13 1 9 8 10 11 10 10 5 12 11 10 10 10 9 10 10 12 11 9 10 7 10 14 7 10 10 12 10 7 9 8 10 8 9 17 13 1 9 11 11 9 8 10 14 5 10 10 18 12 6 10 33 9 6 11 3 12 2 6 19 12 7 12 9 6 2 24 13 1
It just printed as I wrote - first all words and after it length, but I don't know how make it right. Could you tell me how can I print words and directly under their length?