The only hooks you have to work with in a situation
like this is order of the line in the file... ie. last
one gets the update. or a date field.. which could
possibly be entered by a script/small program between
the file and the program that generates the file.
My suggestions are to have a published data in another
file and use your current file as raw data. Parse the
working file with whatever language suits your taste.
then take the update file and merge then two with the
following rules... insert new lines with date stamp in
whatever order you choose(alphanumeric desc/asc) : if
you find matching key, query date stamp and choose
newest one. All this should be part of a automated
batch process. It will change somewhat if you cannot
include a date/time stamp... ie you will have to
depend on the order of the lines in the file to tell
you which one is newer.. and you will have to make a
decision that the new one is always the right one.
After all the batch processing finishing. You should
be left with a file that is ordered, normalized, and
reorganized. That file is then backed up. Then,
pushed to a published location for used by other
programs or people.
Hopes this helps,
Rob
--- Michael C Rock <mikerock01@mindspring.com> wrote:
> Perhaps I need to explain further: I have a 14,000
> line "text" file,
> not specifically a 'data' file as in 'database'
> I have corbeled together a few programs and altered
> them to give me a
> Linux faxserver that both sends and receives faxes
> and distributes them
> to the proper person.
>
> Each line has specific information necessary to
> determine the correct
> routing. I update that file twice daily to reflect
> new faxes having
> been sent out. That information determines the
> routing for received
> faxes. The common field is the phone number field.
> I do not want
> multiple phone number entries so I do a uniq on the
> file and that is
> just fine except that I may be deleting the most
> recent entry and not
> the oldest entry which may have a different person
> as the originator.
>
> So, I have a text file that contains as the first
> field a phone number
> which I need to search for and replace with a newer
> entry for that
> number. I really want to avoid loops on such a
> large file and that is
> why I was looking at a combination of merges, sorts
> and uniq
> statements. That keeps it simple enough for the
> next person to take
> over when I retire next year sometime.
>
> example: *941*4973328
> SENDTO=mrock;MOVETO=/home/rock/fax;;
> *941*5889070
> SENDTO=dstewart;MOVETO=/home/debi/fax;;
>
> a replacement entry might be:
> *941*5889070
> SENDTO=jhines;MOVETO=/home/hines/fax;;
>
> the phone numbers are the same but the data is
> different.
>
> I need to replace the existing line with the new
> one.
>
> On Tue, 2003-08-12 at 17:30, Robert Eanes wrote:
> > Ok firstly... convert to comma delimited... you
> may
> > want to use more than one word in a field some
> day.
> >
> > Secondly, do you have a clear Key for the
> datafile...
> > do your normalization, and reorg.. setup of that
> > process to run once a day or whatever the schedule
> for
> > updates are.. with reporting so you know when you
> need
> > to manually solve a data exception.
> >
> > Thirdly, if you run thing the right way .. ie.
> pick
> > the right tools and have the right processes set
> up ..
> > you should be able to just add the 100 or so lines
> to
> > the end of the file and start the DB maintenance
> cycle
> > for inclusion.
> >
> > Perl is a good tool... But whatever your
> preference..
> > care needs to be taken with the planning and
> > organization of your database.
> >
> > Rob
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Search - Faster. Easier. Bingo.
> > http://search.yahoo.com
> >
>
-----------------------------------------------------------------------
> > This list is provided as an unmoderated internet
> service by Networked
> > Knowledge Systems (NKS). Views and opinions
> expressed in messages
> > posted are those of the author and do not
> necessarily reflect the
> > official policy or position of NKS or any of its
> employees.
> >
> >
>
>
>
-----------------------------------------------------------------------
> This list is provided as an unmoderated internet
> service by Networked
> Knowledge Systems (NKS). Views and opinions
> expressed in messages
> posted are those of the author and do not
> necessarily reflect the
> official policy or position of NKS or any of its
employees.
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:46:14 EDT