Nandy
05-03-2001, 09:59 PM
Once again, here I am...
This is part of the previous Korn script I started some days ago. The problem that have stop me now is the formula I should use to count the lines which are 7 days or older from the current day. Keep in mind I am doing this on Sun Unix using the Korn shell. This is and example:
The file is named "link" and contains the following:
type ab-subdiv allcom/bftl2032540/1 05-04 14:30 intermediate_version
type ab-subdiv allcom/cftl2032540/1 06-03 14:20 intermediate_version
type ab-subdiv allcom/dftl2032540/1 04-01 04:00 intermediate_version
type ab-subdiv allcom/eftl2032540/1 01-19 14:00 intermediate_version
type ab-subdiv allcom/eftl2032540/1 05-11 07:00 intermediate_version
type ab-subdiv allcom/fgtl2032540/1 05-30 17:06 intermediate_version
type ab-subdiv allcom/ftfl2032540/1 05-01 02:11 intermediate_version
type ab-subdiv allcom/ftl2032540/1 02-01 13:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 02-15 14:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 03-01 21:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 03-03 12:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 04-01 14:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 04-29 06:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 05-01 01:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 05-01 15:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 05-06 03:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 06-05 11:00 intermediate_version
type ab-subdiv allcom/ftlg2032540/1 04-21 14:00 intermediate_version
type ab-subdiv allcom/gftl2032540/1 05-01 14:00 intermediate_version
type ab-subdiv allcom/jftl2032540/1 02-14 12:00 intermediate_version
type ab-subdiv allcom/lftl2032540/1 02-09 17:00 intermediate_version
type ab-subdiv allcom/tftl2032540/1 05-23 14:50 intermediate_version
type ab-subdiv allcom/wftl2032540/1 03-27 16:00 intermediate_version
I need the script to sort this file by date to make it easier to see by the user. I can do that ussing "sort -k 4b,4 link", I think that should work. Now after that I need the script to count on how many of these lines the date on field 4 are 7 days or older than the current date. That is what I have no idea how the heck to do. If anybody have an idea I will appreciate it. You really don't have to write the script although it is easier for me to learn that way. What ever you know the answer on bash or korn. I will really appreciate it.
Thanks,
Nandy
This is part of the previous Korn script I started some days ago. The problem that have stop me now is the formula I should use to count the lines which are 7 days or older from the current day. Keep in mind I am doing this on Sun Unix using the Korn shell. This is and example:
The file is named "link" and contains the following:
type ab-subdiv allcom/bftl2032540/1 05-04 14:30 intermediate_version
type ab-subdiv allcom/cftl2032540/1 06-03 14:20 intermediate_version
type ab-subdiv allcom/dftl2032540/1 04-01 04:00 intermediate_version
type ab-subdiv allcom/eftl2032540/1 01-19 14:00 intermediate_version
type ab-subdiv allcom/eftl2032540/1 05-11 07:00 intermediate_version
type ab-subdiv allcom/fgtl2032540/1 05-30 17:06 intermediate_version
type ab-subdiv allcom/ftfl2032540/1 05-01 02:11 intermediate_version
type ab-subdiv allcom/ftl2032540/1 02-01 13:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 02-15 14:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 03-01 21:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 03-03 12:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 04-01 14:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 04-29 06:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 05-01 01:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 05-01 15:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 05-06 03:00 intermediate_version
type ab-subdiv allcom/ftl2032540/1 06-05 11:00 intermediate_version
type ab-subdiv allcom/ftlg2032540/1 04-21 14:00 intermediate_version
type ab-subdiv allcom/gftl2032540/1 05-01 14:00 intermediate_version
type ab-subdiv allcom/jftl2032540/1 02-14 12:00 intermediate_version
type ab-subdiv allcom/lftl2032540/1 02-09 17:00 intermediate_version
type ab-subdiv allcom/tftl2032540/1 05-23 14:50 intermediate_version
type ab-subdiv allcom/wftl2032540/1 03-27 16:00 intermediate_version
I need the script to sort this file by date to make it easier to see by the user. I can do that ussing "sort -k 4b,4 link", I think that should work. Now after that I need the script to count on how many of these lines the date on field 4 are 7 days or older than the current date. That is what I have no idea how the heck to do. If anybody have an idea I will appreciate it. You really don't have to write the script although it is easier for me to learn that way. What ever you know the answer on bash or korn. I will really appreciate it.
Thanks,
Nandy