bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The best way to convert space separated text to TSV?


From: Peng Yu
Subject: Re: The best way to convert space separated text to TSV?
Date: Tue, 11 Feb 2020 09:00:42 -0600

> --- 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 spaces

It sounds like this should be ` print substr($0, offset+1)`. Is it?

> }



-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]