I want to merge two files into Unix. How can I do this?
For example, file 1 includes:
host1: 90: / user: user 1 host 2: 90: / user: user 1 host 3: 90: / Users: User1 host4: 90: / user: user1 host5: 90: / user: user1 host 6: 90: / user: user1 host 7: 90: / user: user1
File 2 includes:
host1: owner_name host2: owner_name host3: owner_name host4: owner_name host5: owner_name host6: owner_name host7: owner_name
Output Result:
Host 1: 90: / user: user1: owner_name host 2: 90: / user: user1: owner_name host3: 90: / user: user1: owner_name host 4: 90: / user: user1: owner_name host 5: 90: / User: user1: Owner_name host6: 90: / users: user1: owner_name host7: 90: / user: user1: owner_name
I used this command paste - D ':' file1 file2 ' Merged_file
, but this is what I'm getting:
host1: 90: / users: user1: host1: owner_name host2: 90: / users: user1: host2: owner_name Host3: 90: / user: user1: host3: owner_name host 4: 90: / user: user1: host4: owner_name host 5: 90: / user: user1: host 5: o wner_name host6: 90: / User: User 1: Host 6: Owner_name Host 7: 90: / User: User 1: host7: owner_name
its Pair: Use join
% join -t ':' file1 file2 host1: 90: / users: user1: owner_name host2: 90: / user: User 1: Owner_name host 3: 90: / user: user1: owner_name host 4: 90: / user: user1: owner_name host 5: 90: / user: user1: owner_name host 6: 90: / user: user 1: Owner_name host 7: 90: / user: user1: owner_name
Comments
Post a Comment