-
January 8th, 2016, 06:06 AM
#1
Modify large text file
I have large text file, I need to find specific value and replace it by given value.
How do I do this by reading line by line and save to same text file
(like notepad, or any other text editor does)
Thanks in advance
Leulae
-
January 8th, 2016, 01:15 PM
#2
Re: Modify large text file
What do you consider "large text file"? How many MBs, GBs?
-
January 14th, 2016, 11:28 PM
#3
Re: Modify large text file
You can, of course, do this in C#, but you might consider using some GNU utilities under Linux or Cygwin (under Windows) to do it as a command-line one-liner, like:
Code:
cat mytextfile.txt | sed 's/regexToFind/replaceWith/g' > mytextfile_fixed.txt
You can also do it with PowerShell on Windows, see e.g.: http://opensysblog.directorioc.net/2...owershell.html
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|