- Learning Linux Shell Scripting
- Ganesh Naik
- 104字
- 2021-06-25 22:02:50
The join command
Consider two files, namely one.txt and two.txt:
- The content of one.txt is as follows:
1 India 2 UK 3 Canada 4 US 5 Ireland
- The content of two.txt is as follows:
1 New Delhi 2 London 3 Toronto 4 Washington 5 Dublin
In this case, for both the files, the common fields are the fields that have serial numbers that are the same in both files. We can combine both files using the following command:
$ join one.txt two.txt
The output will be as follows:
1 India New Delhi 2 UK London 3 Canada Toronto 4 US Washington 5 Ireland Dublin