Hi,
Please excuse for often requesting queries and making R&D, I am trying to work out a possibility where i have two files field separated by pipe and another file containing only one field where there is no matching columns, Could you please advise how to merge two files.
$more top_list.txt_temp_1
PID|USER|PR|NI|VIRT|RES|SHR|S|%CPU|%MEM|TIME+|
2961|aaaa_a|15|0|100m|3196|2624|S|0.0|0.0|0:01.34|
11501|aaaa_a|15|0|100m|3192|2624|S|0.0|0.0|0:00.15|
12759|aaaa_a|16|0|100m|3188|2616|S|0.0|0.0|0:00.49|
21241|aaaa_a|16|0|100m|3200|2628|S|0.0|0.0|0:00.20|
30257|aaaa_a|16|0|100m|3200|2624|S|0.0|0.0|0:00.19|
$more top_list.txt_temp
COMMAND
ssh aaaa_a@aaaaaa
ssh aaaa_a@aaaaaa
ssh aaaa_a@aaaaaa
ssh aaaa_a@aaaaaa
ssh aaaa_a@aaaaaa
required merged file should be like this.
PID|USER|PR|NI|VIRT|RES|SHR|S|%CPU|%MEM|TIME+|COMMAND
2961|aaaa_a|15|0|100m|3196|2624|S|0.0|0.0|0:01.34|ssh aaaa_a@aaaaaa
11501|aaaa_a|15|0|100m|3192|2624|S|0.0|0.0|0:00.15|ssh aaaa_a@aaaaaa
12759|aaaa_a|16|0|100m|3188|2616|S|0.0|0.0|0:00.49|ssh aaaa_a@aaaaaa
21241|aaaa_a|16|0|100m|3200|2628|S|0.0|0.0|0:00.20|ssh aaaa_a@aaaaaa
30257|aaaa_a|16|0|100m|3200|2624|S|0.0|0.0|0:00.19|ssh aaaa_a@aaaaaa
I tried using awk command ,
awk 'FNR == NR { h[$[1]=1; next } !h[$1]' top_list.txt_temp_1
top_list.txt_temp
But it is not working and there is no matching column in my two files.
i am not familiar with join and merge using awk.
Please advsie how to merge the two files.
Thanks,
Regards,
karthikram