f*******n 发帖数: 4 | 1 I have two file, file1 and file2.
the content of file1 is:
a1 b1
a2 b2
a3 b3
and the content of file2 is:
a1 c1
a2 c2
a3 c3
How to write a shell script to obtain a file with data look like:
a1 b1 c1
a2 b2 c2
a3 b3 c3
Thanks in advance |
c*****t 发帖数: 1879 | 2 two commands: cut & paste
(no puns intended)
【在 f*******n 的大作中提到】 : I have two file, file1 and file2. : the content of file1 is: : a1 b1 : a2 b2 : a3 b3 : and the content of file2 is: : a1 c1 : a2 c2 : a3 c3 : How to write a shell script to obtain a file with data look like:
|
f*******n 发帖数: 4 | 3 Thanks coconut;
I find "join file1 file2" works fine too.
【在 c*****t 的大作中提到】 : two commands: cut & paste : (no puns intended)
|
w**a 发帖数: 1024 | 4 paste file1 file2 | awk '{print $1,$2,$4}' > output.dat
【在 f*******n 的大作中提到】 : I have two file, file1 and file2. : the content of file1 is: : a1 b1 : a2 b2 : a3 b3 : and the content of file2 is: : a1 c1 : a2 c2 : a3 c3 : How to write a shell script to obtain a file with data look like:
|