Given that the sample version data contains components of varying widths, e.g. 2.2 and 2.21, I don't think this code is sufficient.
The highlighted expression is a string comparison. v3.9 will be considered greater than v3.10. If the comparison were made using numeric substrings, 3.9 would still be greater than 3.10.
Regards,
Alister
---------- Post updated at 07:04 PM ---------- Previous update was at 07:00 PM ----------
Quick and dirty, as per the topic:
Assumes there is only the one dot in the version numbers, that there are no tabs in the file, and that your field delimiter is a space. If the delimiter is a tab and there are no spaces, change \t to a space.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
Using available (but non-standard) utility msort:
producing:
The intermediate results are on file f1. The awk prints the first occurrence of an item, skipping the rest.
If msort is not in your repository, see link in script for binary or source to compile.
Hi All,
How worried is everyone about the Dirty Cow Linux exploit? Has anybody experienced attacks yet?
From the research I've done it seems that the exploit is "reliable" (that is it works nearly every time on vulverable systems) which is not good news.
We all believe that Unix/Linux... (3 Replies)
Good morning!
I met a problem on a FS with AIX 5.3
It's not possible to mount the FS because of a dirty superblock.
I tried few things without success. I need your help to solve my problem guys. Do you have any idea please?
Thanks a lot
drp01,/home/root # mount /GSPRES/data
Replaying... (9 Replies)
I am creating a small bash file that will take one argument and compile it:
#!/bin/bash
OUT=${$1%.cpp} # C++ source files always end in .cpp
g++ -Wall $1 -o $OUT
chmod 777 $OUT The error message says 'bad substitution', namely where OUT is defined. How to fix this? (1 Reply)