[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 14:50:56 -0600 |
Yes, it does.
On Tue, Feb 11, 2020 at 2:49 PM Manuel Collado <address@hidden>
wrote:
> 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 spaces
> >
> > It 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
>
> --
Regards,
Peng