Link to home
Start Free TrialLog in
Avatar of fcsIT
fcsITFlag for United States of America

asked on

C#.NET - Search, Replace and Update Text Files

I need to write a C#.NET console application that can do the following:

- Read in all text files in a given directory.
- Search each text file in the specified path for a particular text pattern.
- If it does not find the text pattern, it does nothing, and moves on to the next file.
- If it does find the text pattern, it must delete a certain amount of text, stopping at the next place it finds the characters HL*, then update a counter at the bottom of the text file so it shows 7 less than it originally did.

I'm a C#.NET web developer, and know nothing about writing console applications and performing the actions I specified above.  Any help is very appreciated!!

Thanks!
Avatar of David L. Hansen
David L. Hansen
Flag of United States of America image

May I recommend a look through of this tutorial, then start some coding based on that...at that point I/we can help you through with the rest of it.  Sound good?

http://www.withvb.net/tutorials/reading-text-files
Avatar of fcsIT

ASKER

That's in VB.NET.  I write in C#.NET.
ASKER CERTIFIED SOLUTION
Avatar of David L. Hansen
David L. Hansen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fcsIT

ASKER

Powershell would be fine by me.  I've been wanting to get into that!  :)
Great, good luck with it.  You'll find some great powershell experts here.
Are you interested in a PowerShell solution, or have you already sorted it out?
Avatar of fcsIT

ASKER

If you have an example I can work from, yes please.  That would save me a ton of time!!