Hi Gora, Thanks for your reply Its entirely my mistake I din't provide sufficient information.
I wrote :- #!/bin/sh Date > /manish Date –u >> /manish Awk '{print $4}' /manish ############## Now in out put I will get 2 different time I want the difference of these 2 time format And need to run this script only at once. -Manish Popli On 3/8/07, Gora Mohanty <[EMAIL PROTECTED]> wrote: > > On Wed, 2007-03-07 at 17:06 -0500, Manish Popli wrote: > > I need to write a shell script to compare row in a file. and show the > > difference. > > > > Like in row 2nd it showing 21:30:49 > > > > And in row 3rd it showing 19:25:21 > > Incompletely specified. How are the rows separated? What is the > meaning of the fields? Hours:Minutes:Seconds for 24h time? Do > we have to worry about roll-over? Is sanity-checking of file > format, and input values required? Why a shell script? > For a trivial implementation in bash, assuming HH:MM::SS, > disregarding most details and error-checking, save the following > nine lines to a file, say diff.sh, > #!/bin/bash > while read f1 f2 f3 > do > set `IFS=:; echo $f2` > h2=$1; m2=$2; s2=$3 > set `IFS=:; echo $f3` > h3=$1; m3=$2; s3=$3 > echo "Difference is $(($h2*3600+$m2*60+$s2-$h3*3600-$m3*60-$s3))" > done < $1 > > Do, > chmod +x diff.sh > and, invoke as > ./diff.sh test.txt > where test.txt is the name of the file containing your records. > > Regards, > Gora > > > _______________________________________________ > ilugd mailinglist -- ilugd@lists.linux-delhi.org > http://frodo.hserus.net/mailman/listinfo/ilugd > Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi > http://www.mail-archive.com/ilugd@lists.linux-delhi.org/ > -- Manish Popli _______________________________________________ ilugd mailinglist -- ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi http://www.mail-archive.com/ilugd@lists.linux-delhi.org/