
November 3rd, 2003, 03:27 PM
|
 |
Contributing User
|
|
Join Date: Oct 2003
Location: Baltimore, MD
|
|
|
Comparing text strings in Windows 2000
I have a quick question perhaps one of you would be able to help out with.
I am trying to find a way to compare lines in a text file and extract specific lines of text based on the findings. I would like to be able to do this from the command line and set up a batch file to do this automatically for me. The operating system I am using is Windows 2000.
For example, lets say I have a file that is dumped onto a machine every hour. It is a text file that is pipe delimited and contains various bits of information for a customer database. The file is formatted as follows:
OrderNumber|CustomerNumber|PhoneNumber|Address|Etc.|Etc.|Etc.
Every line contains a new order number with customer information. What I would like to do is compare customer numbers between lines and pull out any duplicate customer numbers.
In other words, if two lines in this file have the same customer number, I want to pull one of those lines out and place the information in a seperate file. I want it to happen automatically, without the need for a GUI application. I can do the replacements using a port of Sed for Windows, I just can't figure out how to compare individual lines for diplicate data.
Sorry for the lengthy description, just want to make sure I supply everyone with the right amount of info.
Thanks!
|