Discussion:
how to duplicate "columns" in a file
s***@gmx.de
2013-05-16 18:17:15 UTC
Permalink
Hi all,

hope you can help me with how to duplicate "columns" in a file:

before:

aaa
bbb
ccc


after:

aaa aaa
bbb bbb
ccc ccc


Thanks in advance,
Magnus
Tim Chase
2013-05-16 18:43:45 UTC
Permalink
Post by s***@gmx.de
aaa
bbb
ccc
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

Loading...