fcsIT
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!
- 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!
ASKER
That's in VB.NET. I write in C#.NET.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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?
ASKER
If you have an example I can work from, yes please. That would save me a ton of time!!
http://www.withvb.net/tutorials/reading-text-files