0

I am trying to combine two text files each containing one column of numbers, I am using paste method to achieve this, but when I run my script it doesn't put them together correctly rather it skips a line and puts it in the opposide side. I checked if there are any hidden spaces and I could not see anything like that. Anyone knows how to achieve my goal?

Script:

grep '<ID>' base_*.dat | sed 's/.*>//' > id
grep '<Name>' base_*.dat | sed 's/.*>//' > name
paste id name > result

Current output:

5
    5
4
    5
4
    -1
5
    5
5
    -1

Intended output:

5    5
4    5
4   -1
5    5
5   -1
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

0 Answers0