|
From: | Manuel Collado |
Subject: | Re: The best way to convert space separated text to TSV? |
Date: | Tue, 11 Feb 2020 21:49:22 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
El 11/02/2020 a las 16:00, Peng Yu escribió:
--- tabular1,awk --- { nf = split($0, f, " ", s) offset = length(s[0]) for (n=1; n<numcols; n++) { # first numcols-1 columns offset = offset + length(f[n]) + length(s[n]) printf("%s\t", f[n]) } print substr($0, offset) # last column, with spacesIt sounds like this should be ` print substr($0, offset+1)`. Is it?
Oops! Yes.
}
Besides this, does it answer your original question? Regards. -- Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
[Prev in Thread] | Current Thread | [Next in Thread] |