IanWood
asked on
Batch file to remove commas from a different file.
I need to run a command from a batch file that removes commas from a specified file. Not too bothered what it does with them, either remove completely or replace with another character.
This is to stop user entered commas from messing up my format in a .CSV file.
Many thanks in advance!
Ian
This is to stop user entered commas from messing up my format in a .CSV file.
Many thanks in advance!
Ian
ASKER
I don't really want to start using 3rd party uliities to do this if I can help it.
The file is a bog standard text file (seperated by |'s) :-
H||Mrs|Elizabeth|Jones|7 wood Drive|Four Trees|Sutton|West Midlands|B74 5RD|01564 353 43334|liz@hotmail.com|Y|Mr s Elizabeth Jones|7 Wood Drive|Four Trees|Sutton|West Midlands|B74 5RD|Mrs Elizabeth Jones|7 wood Drive|Four Trees|Sutton|West Midlands|B74 5RD|VI|1234556578912345678 |1102|1204 ||181927|2 80804|09:0 5|850|13|
D|26153|Sensitive Moisturising Body Lotion - 250ml|400|3|1200|
D|30064|30064|250|1|250|
I'm running XP, but any solution should ideally work on 2000 as well.
Thanks!
The file is a bog standard text file (seperated by |'s) :-
H||Mrs|Elizabeth|Jones|7 wood Drive|Four Trees|Sutton|West Midlands|B74 5RD|01564 353 43334|liz@hotmail.com|Y|Mr
D|26153|Sensitive Moisturising Body Lotion - 250ml|400|3|1200|
D|30064|30064|250|1|250|
I'm running XP, but any solution should ideally work on 2000 as well.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I really don't know much about scripting but here is a site: http://www.easydos.com/dosindex.html
I would think you would have to use the: IF, FIND, and DEL command in one string. Good Luck and I hope this helps.
I would think you would have to use the: IF, FIND, and DEL command in one string. Good Luck and I hope this helps.
ASKER
SirBounty, That seems to work fine. one thing, is there anyway to keep the original filename?
Thanks!
Thanks!
If you're reading it line by line, then you'll have to export it into another file (I think munge will allow this).
For the code above though, simply add the following just before the goto :eof line:
if exist testnew.txt del test.txt
ren testnew.txt test.txt
For the code above though, simply add the following just before the goto :eof line:
if exist testnew.txt del test.txt
ren testnew.txt test.txt
http://www.petri.co.il/download_free_reskit_tools.htm
If you're opposed to that idea, can you post a portion of your file along with what operating system you're using?