Re: how to duplicate "columns" in a file

Tim Chase <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 2013-05-16 20:17, [email protected] wrote:
> hope you can help me with how to duplicate "columns" in a file:
>  
> before:
>  
> aaa
> bbb
> ccc
>  
>  
> after:
>  
> aaa aaa
> bbb bbb
> ccc ccc

If that's all you want, it should be as simple as

  sed 's/.*/& &/' infile.txt > outfile.txt

If you have multiple columns and only want to delimit certain ones,
you'd have to provide more detail:  Are they tab-delimited vs.
space-delimited vs. comma-delimited?  Are fields quoted, and if so,
how?  Which columns need to be duplicated, and where do the
duplicated need to appear?

-tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.