1

I'm trying to combine two different files, one called itemnum and another called items.

itemnum contains:

ItemNumber
1201
1221
1320
1340
1410

and items contains:

Item
Lobby Furniture
Ballroom Specialties
Poolside Carts
Formal Dining Specials
Reservation Logs

I want to use join here right? So that the output looks like this:

ItemNumber:Item
1201:Lobby Furniture
1221:Ballroom Specialties
1320:Poolside Carts
1340:Formal Dining Specials
1410:Reservation Logs

I can't even figure out how to get them to join, let alone add the :

I tried join itemnum items > prodinfo, but that just gives me an empty file.

3
  • I guess you've misunderstood the join command. Check linux.die.net/man/1/join
    – ott--
    Commented Aug 30, 2016 at 21:19
  • 1
    The join command joins files on a common key (which your files do not appear to have) - if you just want to join successive lines from each file side-by-side you can use the paste command instead e.g. paste -d\: itemnum items > prodinfo Commented Aug 30, 2016 at 21:20
  • How would I add a colon? Using -d? Commented Aug 30, 2016 at 21:21

1 Answer 1

3

As mentioned : Join requires a key column and isn't the right command for what you are looking to do. Confirmed as @steeldriver says

paste -d : file1.txt file2.txt > filemerge.txt

You must log in to answer this question.

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