1

I have a file with the following:

e1
ed1
e2
ed2
e3
ed3
.
.
.
en
edn

And what I need is to get it like this:

e1  ed1
e2 ed2
e3 ed3
...
...
...
en edn

I think maybe I can use grep a and make a single column file containing all e's and do the same with the ed's, then simply paste both columns.

but will grep keep the order in the file? (guarantee that e1 will be matching ed2 and so on) it is really large data so there is no way to know verify it manually

Also I don't know the correct syntax is, so far what I've tried goes like this:

$ grep -o "e" file.txt > thees.txt #this should give me the first column
$ grep -o "ed" file.txt > theeds.txt #this should give me the second column
$ paste thees.txt theeds.txt > bothesandeds.txt #this should join them
$ rm thees.txt
$ rm theeds.txt

What I end up with is:

e ed
e ed
e ed
...
...
...
e ed
cfrick
  • 35,203
  • 6
  • 56
  • 68
ca_san
  • 183
  • 2
  • 11

0 Answers0