# How to repeat each line of a file, from the Linux command line?

How to make a file like:

one
two
three
...


into:

one one
two two
three three
...


I'm thinking this must be possible with one simple Linux command. If my editor had block selections or macros I could do it easily. I'm using Geany right now. Maybe I need to switch editors again, or find a Geany plugin.

-
I ended up installing SlickEdit (the original "E" editor) and recorded a macro to cut/paste the current line twice, skip to the next line, then hold down Ctrl+F12. If I don't end up buying SlickEdit, I'll keep an eye on these other answers for future reference, tnx. –  PJ Brunet Oct 20 '11 at 10:21

You need the paste command:

$cat > file one two three four ...$ paste file file
one     one
two     two
three   three
four    four
...     ...
$ - $ cat t
ccc
ddd
aaa
bbb

$perl -p -i -e 's/.*/$& $&/' t$ cat t
ccc ccc
ddd ddd
aaa aaa
bbb bbb

-
I played with your answer a little bit, this seems to work too: sed 's/.*/& &/' t –  PJ Brunet Oct 20 '11 at 10:40