I need to write a batch file that will take in a file and replace all commas with tabs.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
@echo off
setlocal enabledelayedexpansion
for /f “delims=] tokens=1*” %%a in (‘find /v /n “” ^<%1’) do (
set line=%%b
if not “%line%” == “” set line=%line:,= %
echo.!line!
)
But it sounds like you want to convert a comma-separated-values (.csv) file to a tab-separated values file. If that’s the case, be careful. A simple comma-to-tab substitution doesn’t always work. Some values contain commas or tabs. They are enclosed in quotes if they do. So you need a more sophisticated utility to deal with csv files properly. Have a google and you should find something. Alternatively, open the csv in Excel and save it as a tab-delimited text file.