Home All Groups Group Topic Archive Search About

Modifying a text file

Author
23 Jan 2006 6:24 PM
soup_nazi
I want to remove duplicate entries within a text file.  So if I had
this within a text file...

Applications/Diabetic Registry/
Applications/Diabetic Registry/
Applications/Diabetic Registry/
Applications/Great Plains/
Applications/Great Plains/
Applications/Great Plains/
Applications/Great Plains/Servers/
Applications/Great Plains/Servers/
Applications/HeartBase/
Applications/HeartBase/
Applications/HeartBase/
Applications/HHC/
Applications/HHC/
Applications/HHC/
Applications/HHC/

I would want the result to be this:

Applications/Diabetic Registry/
Applications/Great Plains/
Applications/Great Plains/Servers/
Applications/HeartBase/
Applications/HHC/

I've tried using StreamReader and StreamWriter simulataneously with no
success...any other ideas?

Author
23 Jan 2006 6:46 PM
nelsonhaha
If the file isn't very large you could load all the lines of the file
into an array and remove duplicates from the array and rewrite the
file.  If you need code on how to remove duplicates using an array let
me know and I'll post it.

-Nelson
soup_nazi wrote:
Show quoteHide quote
> I want to remove duplicate entries within a text file.  So if I had
> this within a text file...
>
> Applications/Diabetic Registry/
> Applications/Diabetic Registry/
> Applications/Diabetic Registry/
> Applications/Great Plains/
> Applications/Great Plains/
> Applications/Great Plains/
> Applications/Great Plains/Servers/
> Applications/Great Plains/Servers/
> Applications/HeartBase/
> Applications/HeartBase/
> Applications/HeartBase/
> Applications/HHC/
> Applications/HHC/
> Applications/HHC/
> Applications/HHC/
>
> I would want the result to be this:
>
> Applications/Diabetic Registry/
> Applications/Great Plains/
> Applications/Great Plains/Servers/
> Applications/HeartBase/
> Applications/HHC/
>
> I've tried using StreamReader and StreamWriter simulataneously with no
> success...any other ideas?
Author
23 Jan 2006 6:51 PM
Mitchell S. Honnert
What does "no success" mean?  Are you having trouble finding the unique
values or doing a read and a write in the same loop?  In either case, I'm
thinking that you could load each item into a collection that doesn't allow
duplicates -- I can't think of which one you'd want off the top of my head,
but there's probably something in the Framework that will suit -- then write
the values back out to a file.

Maybe you could post some pseudo code or describe the exact nature of your
problem.

Mitchell S. Honnert
www.UltraID3Lib.com


Show quoteHide quote
"soup_nazi" <bcah***@wfs-ops.org> wrote in message
news:1138040686.826773.312760@z14g2000cwz.googlegroups.com...
>I want to remove duplicate entries within a text file.  So if I had
> this within a text file...
>
> Applications/Diabetic Registry/
> Applications/Diabetic Registry/
> Applications/Diabetic Registry/
> Applications/Great Plains/
> Applications/Great Plains/
> Applications/Great Plains/
> Applications/Great Plains/Servers/
> Applications/Great Plains/Servers/
> Applications/HeartBase/
> Applications/HeartBase/
> Applications/HeartBase/
> Applications/HHC/
> Applications/HHC/
> Applications/HHC/
> Applications/HHC/
>
> I would want the result to be this:
>
> Applications/Diabetic Registry/
> Applications/Great Plains/
> Applications/Great Plains/Servers/
> Applications/HeartBase/
> Applications/HHC/
>
> I've tried using StreamReader and StreamWriter simulataneously with no
> success...any other ideas?
>
Author
23 Jan 2006 6:58 PM
Cor Ligthert [MVP]
Soup_nazi,

Do you have an explenation for the Nick you are using.

This is an International newsgoup. For some people in the world can the nick
you use be quiet shocking.

So please if you don't have a good explanation, change it.

Cor
Author
23 Jan 2006 8:28 PM
Gerald Hernandez
Show quote Hide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:%23r42FSFIGHA.2680@TK2MSFTNGP09.phx.gbl...
> Soup_nazi,
>
> Do you have an explenation for the Nick you are using.
>
> This is an International newsgoup. For some people in the world can the
nick
> you use be quiet shocking.
>
> So please if you don't have a good explanation, change it.
>
> Cor
>

Cor,

I believe his nickname is based on a character from a comedy television show
called Seinfeld.
This character had a shop where they sold very good soup. However, he had a
very unpleasant personality and due to the way he behaved, the other
characters on the show gave him the nickname Soup Nazi. Within the context
of this show, it is very funny.

However, taken out of context and without knowledge of the show, it very
well could be shocking and/or offensive to others. From my point of view, I
believe I can safely say that the poster has absolutely no intention of
offending anyone. But since this is an International newsgroup, they might
want to reconsider their chosen nickname.

Gerald
Author
23 Jan 2006 9:15 PM
kevininstructor@state.or.us
I would agree, have seen this show but has no place here.

Show quoteHide quote
"Gerald Hernandez" <Cablewizard@spam_remove@Yahoo.com> wrote in message
news:OYbYLuFIGHA.604@TK2MSFTNGP14.phx.gbl...
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:%23r42FSFIGHA.2680@TK2MSFTNGP09.phx.gbl...
>> Soup_nazi,
>>
>> Do you have an explenation for the Nick you are using.
>>
>> This is an International newsgoup. For some people in the world can the
> nick
>> you use be quiet shocking.
>>
>> So please if you don't have a good explanation, change it.
>>
>> Cor
>>
>
> Cor,
>
> I believe his nickname is based on a character from a comedy television
> show
> called Seinfeld.
> This character had a shop where they sold very good soup. However, he had
> a
> very unpleasant personality and due to the way he behaved, the other
> characters on the show gave him the nickname Soup Nazi. Within the context
> of this show, it is very funny.
>
> However, taken out of context and without knowledge of the show, it very
> well could be shocking and/or offensive to others. From my point of view,
> I
> believe I can safely say that the poster has absolutely no intention of
> offending anyone. But since this is an International newsgroup, they might
> want to reconsider their chosen nickname.
>
> Gerald
>
>
Author
25 Jan 2006 6:56 PM
soup_jerk
apologize for offending anyone...this was referring to a Seinfeld
character.