We help IT Professionals succeed at work.

Update a String Value in a CSV File

961 Views
Last Modified: 2013-11-26
hi all,
I have a csv file which i need to search for a specific word in it and update the field next to it. The csv file look like the following:
Name,Permissions,DataType,Precision,InitialValue,...etc

I want to search by Name, and If found then replace the "InitialValue" for that Name.

Anyone knows how?
Thanks
Comment
Watch Question

CERTIFIED EXPERT

Commented:
do you have a small csv file to text with?

Author

Commented:
here is a modified one, the original is to large...

just change the extension to .csv before opening the file because I couldn't attach a .csv file...
example.txt
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Commented:
I was thinking that you might have to load a dataset or datatable.
I was testing the idea of using regular expressions. So far no luck.

Author

Commented:
The solution I have might not be the best, but it works and gets the job done

I've used this:
DIM str = System.Text.RegularExpressions.Regex.Split(sr.ReadToEnd(), "\r\n")
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.