2

Its my first time posting in Stackoverflow, so please understand if my question is not clear.

In bash, I am trying to manipulate the file content. Essentially, I want to go from

AA123

AA123

BB123

BB123

CC123

CC123

to

AA123    AA123 

BB123    BB123

CC123    CC123

The space between duplicate words is tab delimited

Basically, unique string appears every 2n+1 line (n>=0) in the original file, and I want to move the "2n"th line to the previous line.

How can I accomplish this in Bash???

I am sorry if the description is too abstract, but please bear with me,,,

Thank you everyone

p.s. Number of unique string can be any number, but will always occur as a pair

djskj189
  • 285
  • 1
  • 5
  • 15

1 Answers1

1

With GNU or BSD bash:

printf "%s\t%s\n\n" $(< file)

Output:

AA123   AA123

BB123   BB123

CC123   CC123

Cyrus
  • 84,225
  • 14
  • 89
  • 153