from the posting i think all the data are in a single file. using join fil1 fil2 is not possible unless you separate it into two different files. But is there an alternative without separating it into different files?
#> cat zam
1 909 YES NO
2 500 No NO
1 909 262 647
2 456 234 666
#> /usr/xpg4/bin/awk '{ x[$1] = x[$1]FS$2FS$3FS$4; } END { for (i in x) {print i x}}' zam
2 500 No NO 456 234 666
1 909 YES NO 909 262 647
One more Q on above if I may
I have customised , formated a bit above command (may be not perfect but Ok for me) and I wonder if I can print only if $3-$4 >0
cat tmp.lst|grep -v '#'|grep -v '-'|awk '{a[$1]=a[$1] FS $2" "$3" "$4} END {for (i in a) {print i, a[i]}}'\
|awk '{print $1" "$2" "$3" "$4" "$5}' >>tmp1.lst
I know I could have read docs but human nature ... looking for easy ways ..
Thanks again
---------- Post updated at 02:57 PM ---------- Previous update was at 02:42 PM ----------
No worries I figured it out...
It turned out to be very easy
cat tmp.lst|grep -v '#'|grep -v '-'|awk '{a[$1]=a[$1] FS $2" "$3" "$4} END {for (i in a) {print i, a[i]}}'|awk '{if ($3>$4) print $1" "$2" "$3" "$4" "$5}'
Thank you rdcwayx!
Yes will use it. Getting better and better at awk . $3&$4 are correct as I removed 2 values from the original rows.
My final out put will look like below (but formatted propely)
| PRIMARY | PHYSICAL STANDBY |
Thread Last Seq Gen Last Seq Rec Last Seq Applied Diff
----- ------------- ----------- ---------------- -----
1 1034 1034 262 772