Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

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

2 Answers 2

You need the paste command:

$ cat > file
one
two
three
four
...
$ paste file file
one     one
two     two
three   three
four    four
...     ...
$
share|improve this answer
$ cat t
ccc
ddd
aaa
bbb

$ 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.