Computing.Net > Forums > Unix > how to compare

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

how to compare

Reply to Message Icon

Name: gandeshravan
Date: September 10, 2008 at 08:00:15 Pacific
OS: windows wp
CPU/Ram: intel
Comment:

Hi
i have different versions like v1.0.0.0,v1.0.2.0 and etc in each version i have a file called checksum.csv.
in checksum.csv i have different scripts

i want to compare these .csv file with each version.
if i get any new script in the.csv file of the version i have to display the name of the script and version of that and these should be sent to a log file.

can u help me in this issue

thanks in advance



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: September 10, 2008 at 14:26:36 Pacific
Reply:

I don't understand your question.


0

Response Number 2
Name: gandeshravan
Date: September 11, 2008 at 00:21:54 Pacific
Reply:

Hi
i have different directoris like v1.0.0.0,v1.0.2.0.....V1.0.7.0 in each directory i have a file called checksum.csv.
in checksum.csv i have many scripts like procStartAcq.ksh,Proctitu.ksh etc

For every directorty i have one checksum.csv file

i want to compare these .csv file with each directory V1.0.0.0.
if i get any new script in the.csv file of the version i have to display the name of the script and version of that and these should be sent to a log file.


0

Response Number 3
Name: nails
Date: September 11, 2008 at 23:18:36 Pacific
Reply:

I'm still not sure of your spec, but I check each checksum..csv file against v1.0.0.0/checksum.csv.

assumed each of your scripts were more than one to a line separated by commas.

Also, assumed all directories were on one level and the script either exists at that level or you place a cd command.

Let me know if you have any questions.


!/bin/ksh

# cd <to mydir location>
dd=$(pwd)
cfile="${dd}/v1.0.0.0/checksum.csv.tmp"
cd "./v1.0.0.0"
sed 's/,/ /g' checksum.csv|xargs -n1 > checksum.csv.tmp
cd ..
rm -f /tmp/logfile.txt

find . -type d -name "v1.0.*" -print|while read mydir
do
if [[ "$mydir" == "./v1.0.0.0" ]]
then
continue
fi

cd "$mydir"
rm -f checksum.csv.tmp
# place all the scripts on one line
sed 's/,/ /g' checksum.csv|xargs -n1 > checksum.csv.tmp
while read line
do
cnt=1
while read myscript
do
if [[ "$line" = "$myscript" ]]
then
cnt=0
break
fi
done < "$cfile"

if [[ cnt -eq 1 ]]
then # send it to file if script not found
echo "${mydir}:${line}" >> /tmp/logfile.txt
fi
done < checksum.csv.tmp
cd ..
done



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Need help in XIPT003I how to read a file



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: how to compare

How to compare form feed? www.computing.net/answers/unix/how-to-compare-form-feed/6817.html

how to do comparision www.computing.net/answers/unix/how-to-do-comparision/8208.html

How to compare two files in UNXI www.computing.net/answers/unix/how-to-compare-two-files-in-unxi/8278.html