Awk and bash script?

Use tar -xzvf /mnt/cf/bundle. Tgz -O version. Txt to extract the version.

Use tar -xzvf /mnt/cf/bundle. Tgz -O version. Txt to extract the version.

The tricky part is how to handle the version. If your version has always three digits, then I suggest to multiply each part with 1000. That will give you a large number which you can easily compare.I.e.1.0.0 == 1000000000; 1.0.1 = 1000000001.

Another option is to format each part with %04d: 0001.0000.0000 and 0001.0000.0001. These strings can be compared.

Apologies for the downvote and the negative comment, but I'm always suspicious of homework type questions. To make amends, I've done it for you. You don't need awk, it can all be done in bash.

Just set F1 and F2 to the correct filenames. I'll leave it as an exercise for you to accept them as command line arguments :) #! /usr/bin/env bash F1=f1.

Tgz F2=f2. Tgz VERSION_FILE=version. Txt version1=`tar -xzf $F1 -O $VERSION_FILE|sed -e 's/.

*version=//'` version2=`tar -xzf $F2 -O $VERSION_FILE|sed -e 's/. *version=//'` if "$version1" == "$version2" ; then echo "$F1 and $F2 contain the same version: $version1, $version2" exit 0; fi ( # start a subshell because we're changing IFS # Assume F1 is the latest file unless we find otherwise below latest_file=$F1 latest_version=$version1 # set the Internal Field Separator to a dot so we can # split the version strings into arrays IFS=. # make arrays of the version strings v1parts=( $version1 ) v2parts=( $version2 ) # loop over $v1parts, comparing to $v2parts # NOTE: this assumes the version strings have the same # number of components.

If won't work for 1.1 and 1.1.1, # You'd have to have 1.1.0 and 1.1.1 # You could always add extra '0' components to the shorter array, but # life's too short... for ((i = 0 ; I.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions