Re: [SLUG] search and replace

From: Michael C Rock (mikerock01@mindspring.com)
Date: Tue Aug 12 2003 - 21:14:00 EDT


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.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:36:52 EDT