Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to make a file like:



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.

share|improve this question
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
$ paste file file
one     one
two     two
three   three
four    four
...     ...
share|improve this answer
Careful that by default paste will use tabs as delimiters, you can override this with the -d option: paste -d ' ' file file > outputfile – Jean-Karim Bockstael May 23 at 8:18
$ cat t

$ perl -p -i -e 's/.*/$& $&/' t

$ cat t
ccc ccc
ddd ddd
aaa aaa
bbb bbb
share|improve this answer
I played with your answer a little bit, this seems to work too: sed 's/.*/& &/' t – PJ Brunet Oct 20 '11 at 10:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .