Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matching files 1

Status
Not open for further replies.

kHz

MIS
Dec 6, 2004
1,359
US
Example files:

CT0103@21.txt.Z IN1216@21.txt.Z MD1228@08.txt.Z MT1231@08.txt.Z NM0105@09.txt.Z PA0110@18.txt.Z TX1224@20.txt.Z WV1230@03.txt.Z
CT0103@22.txt.Z IN1216@22.txt.Z MD1228@09.txt.Z MT1231@09.txt.Z NM0105@10.txt.Z PA0110@19.txt.Z TX1224@21.txt.Z WV1230@04.txt.Z
CT0103@23.txt.Z IN1216@23.txt.Z MD1228@10.txt.Z MT1231@10.txt.Z NM0105@11.txt.Z PA0110@20.txt.Z TX1224@22.txt.Z WV1230@05.txt.Z
CT0104@00.txt.Z IN1217@00.txt.Z MD1228@11.txt.Z MT1231@11.txt.Z NM0105@12.txt.Z PA0110@21.txt.Z TX1224@23.txt.Z WV1230@06.txt.Z
CT0104@01.txt.Z IN1217@01.txt.Z MD1228@12.txt.Z MT1231@12.txt.Z NM0105@13.txt.Z PA0110@22.txt.Z TX1227@00.txt.Z WV1230@07.txt.Z
CT0104@02.txt.Z IN1217@02.txt.Z MD1228@13.txt.Z MT1231@13.txt.Z NM0105@14.txt.Z PA0110@23.txt.Z TX1227@01.txt.Z WV1230@08.txt.Z
CT0104@03.txt.Z IN1217@03.txt.Z MD1228@14.txt.Z MT1231@14.txt.Z NM0105@15.txt.Z PA0111@00.txt.Z TX1227@02.txt.Z WV1230@09.txt.Z
CT0104@04.txt.Z IN1217@04.txt.Z MD1228@15.txt.Z MT1231@15.txt.Z NM0105@16.txt.Z PA0111@01.txt.Z TX1227@03.txt.Z WV1230@10.txt.Z
CT0104@05.txt.Z IN1217@05.txt.Z MD1228@16.txt.Z MT1231@16.txt.Z NM0105@17.txt.Z PA0111@02.txt.Z TX1227@04.txt.Z WV1230@11.txt.Z
CT0104@06.txt.Z IN1217@06.txt.Z MD1228@17.txt.Z MT1231@17.txt.Z NM0105@18.txt.Z PA0111@03.txt.Z TX1227@05.txt.Z WV1230@12.txt.Z
CT0104@07.txt.Z IN1217@07.txt.Z MD1228@18.txt.Z MT1231@18.txt.Z NM0105@19.txt.Z PA0111@04.txt.Z TX1227@06.txt.Z WV1230@13.txt.Z
CT0104@08.txt.Z IN1217@08.txt.Z MD1228@19.txt.Z MT1231@19.txt.Z NM0105@20.txt.Z PA0111@05.txt.Z TX1227@07.txt.Z WV1230@14.txt.Z
CT0104@09.txt.Z IN1217@09.txt.Z MD1228@20.txt.Z MT1231@20.txt.Z NM0105@21.txt.Z PA0111@06.txt.Z TX1227@08.txt.Z WV1230@15.txt.Z
CT0104@10.txt.Z IN1217@10.txt.Z MD1228@21.txt.Z MT1231@21.txt.Z NM0105@22.txt.Z PA0111@07.txt.Z TX1227@09.txt.Z WV1230@16.txt.Z
CT0104@11.txt.Z IN1217@11.txt.Z MD1228@22.txt.Z MT1231@22.txt.Z NM0105@23.txt.Z PA0111@08.txt.Z TX1227@10.txt.Z WV1230@17.txt.Z
CT0104@12.txt.Z IN1217@12.txt.Z MD1228@23.txt.Z MT1231@23.txt.Z NM0106@00.txt.Z PA0111@09.txt.Z TX1227@11.txt.Z WV1230@18.txt.Z
CT0104@13.txt.Z IN1217@13.txt.Z MD1229@00.txt.Z NC0103@00.txt.Z NM0106@01.txt.Z PA0111@10.txt.Z TX1227@12.txt.Z WV1230@19.txt.Z
CT0104@14.txt.Z IN1217@14.txt.Z MD1229@01.txt.Z NC0103@01.txt.Z NM0106@02.txt.Z PA0111@11.txt TX1227@13.txt.Z WV1230@20.txt.Z
CT0104@15.txt.Z IN1217@15.txt.Z MD1229@02.txt.Z NC0103@02.txt.Z NM0106@03.txt.Z PA1221@18.txt.Z TX1227@14.txt.Z WV1230@21.txt.Z


Somebody has been creating these files every hour of every day for about a month. What I need to do is to compare the data against two files for each day. For example, I need to compare the data in AZ1229@00.txt.Z with AZ1229@23.txt.Z and so on, for each day for each state (don't ask - your tax dollars at work [smile] ).

I have tried multiple things, and I am stumped about how I can accomplish this.

Any ideas, tips, hints are welcome.

Thanks!
 
ok, how about something like that [for starters]- sorry for the wrapped lines:

Code:
#!/bin/ksh

#  AZ1229@00.txt.Z

ext='.txt.Z'

time1='00'
time2='23'

for date in $(ls *Z | sed -e 's/^..\(....\).*/\1/g' | sort -u) ; do
    echo "date->[${date}]"
    for state in $(ls *${date}@*Z | sed -e 's/^\(..\).*/\1/g' | sort -u) ; do
        echo "    state->[${state}]"
        echo "       comparing [${state}${date}@${time1}${ext}] to [${state}${date}@${time2}${ext}]"
    done;
done

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Great! Thanks a lot. I was stumped about comapring those dates and times on the filenames.
 
a bit better version:

Code:
#!/bin/ksh

#  AZ1229@00.txt.Z

ext='.txt.Z'

time1='00'
time2='23'

for date in $(printf "%s\n" *${ext} | sed -e 's/^..\(....\).*/\1/g' | sort -u) ; do
    echo "date->[${date}]"
    for state in $(printf "%s\n" *${date}@*${ext} | sed -e 's/^\(..\).*/\1/g' | sort -u) ; do
        echo "    state->[${state}]"
        echo "       comparing [${state}${date}@${time1}${ext}] to [${state}${date}@${time2}${ext}]"
    done;
done

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks.

I am now comparing the data.

Thanks a lot again!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top