Sample Header Ad - 728x90

The "join" utility reports: file is not sorted, but in fact it is sorted

3 votes
1 answer
647 views
I have two files t1 and t2. root@localhost:~# root@localhost:~# cat t1 udp UNCONN 0 0 0.0.0.0:68 0.0.0.0:* users:(("dhclient",pid=479,fd=7)) 479 tcp LISTEN 0 128 127.0.0.1:6060 0.0.0.0:* users:(("gggg-ruit",pid=24968,fd=5)) 24968 root@localhost:~# root@localhost:~# cat t2 root 88 0.0 0.0 0 0 ? I< Jan06 0:00 [scsi_tmf_0] root 96 0.0 0.0 0 0 ? I< Jan06 0:00 [ipv6_addrconf] root 24965 0.0 0.2 11592 3004 ? S Jan12 0:00 bash /root/restart_gggg.sh root 24968 0.7 5.2 112488 53472 ? Sl Jan12 30:52 /usr/local/bin/gggg-ruit -singleInstance :44444 I want to join them on the 8th column of t1 and the 2nd column of t2. I already have them in sorted order. Let's prove it. root@localhost:~# awk '{print $8}' t1 479 24968 root@localhost:~# awk '{print $2}' t2 88 96 24965 24968 Now when I join them, I got the following error. root@localhost:~# join -1 8 -2 2 -o 2.1,2.2,1.1,1.2,1.5,1.6,2.11 t1 t2 join: t2:3: is not sorted: root 24965 0.0 0.2 11592 3004 ? S Jan12 0:00 bash /root/restart_gggg.sh root@localhost:~# Why it tells me t2 is not sorted on row 3? As you can see, it's been already sorted on the join column.
Asked by Just a learner (2022 rep)
Jan 15, 2020, 01:54 PM
Last activity: Aug 31, 2024, 04:35 AM