Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Sort and Remove Duplicates From a text file - vbscript

Posted on 2003-02-20
4
Medium Priority
?
478 Views
Last Modified: 2008-02-01
I'm trying to sort and dedup the following text file containing around 8500 records using vbscript:
(sample.txt)
FFPAWQ00000031|Y
FFPAWQ00000302|Y
FFPAWQ00000201|Y
FFPAWQ00000022|Y
FFPAWQ00000305|Y
FFTXWQ00000031|Y
FFTXWQ00000301|Y
FFPAWQ00000031|Y

This file is locally on my computer and I would like to just execute a vbscript file to sort/dedup this file when necessary.
0
Comment
Question by:amathies
2 Comments
 
LVL 22

Accepted Solution

by:
grg99 earned 300 total points
ID: 7990758
I would suggest running the standard DOS/Windows command "sort", it does an excellent job of sorting files of any size, quite quickly.

But it doesnt remove duplicates, but once the file is sorted, it only takes about 10 lines of code to remove duplicates.

open the file
oldline = "";

1 read newline
if newline <> oldline print newline to file
oldline = newline
goto 1
0
 

Expert Comment

by:CleanupPing
ID: 9474642
amathies:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question