?
Solved

Sort and Remove Duplicates From a text file - vbscript

Posted on 2003-02-20
4
Medium Priority
?
474 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

777 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