Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I came across and solved this problem, to add an additional (and shorter and simpler) answer...</p> <p>First note, extended shell comparison failed as you may already know...</p> <pre><code> if [[ 1.2.0 &lt; 1.12.12 ]]; then echo true; else echo false; fi false </code></pre> <p>Using the sort -t'.'-g (or sort -V as mentioned by kanaka) to order versions and simple bash string comparison I found a solution. The input file contains versions in columns 3 and 4 which I want to compare. This iterates through the list identifying a match or if one is greater than the other. Hope this may still help anyone looking to do this using bash as simple as possible.</p> <pre><code>while read l do #Field 3 contains version on left to compare (change -f3 to required column). kf=$(echo $l | cut -d ' ' -f3) #Field 4 contains version on right to compare (change -f4 to required column). mp=$(echo $l | cut -d ' ' -f4) echo 'kf = '$kf echo 'mp = '$mp #To compare versions m.m.m the two can be listed and sorted with a . separator and the greater version found. gv=$(echo -e $kf'\n'$mp | sort -t'.' -g | tail -n 1) if [ $kf = $mp ]; then echo 'Match Found: '$l elif [ $kf = $gv ]; then echo 'Karaf feature file version is greater '$l elif [ $mp = $gv ]; then echo 'Maven pom file version is greater '$l else echo 'Comparison error '$l fi done &lt; features_and_pom_versions.tmp.txt </code></pre> <p>Thanks to Barry's blog for the sort idea... ref: <a href="http://bkhome.org/blog/?viewDetailed=02199" rel="nofollow">http://bkhome.org/blog/?viewDetailed=02199</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload