Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

I need a .bat file!

Original Message
Name: learner
Date: March 25, 2008 at 00:54:46 Pacific
Subject: I need a .bat file!
OS: xp/windows
CPU/Ram: Dual core/512
Model/Manufacturer: Intel
Comment:
I need a .bat file to to change a text file with one row that has 100 names, separated by comma with no quotes to one column with 100 records/rows.


Report Offensive Message For Removal


Response Number 1
Name: IVO
Date: March 25, 2008 at 02:42:23 Pacific
Subject: I need a .bat file!
Reply: (edit)
Beware the following batch works in Windows NT/2K/XP only NOT in Windows 9X/ME.

@echo off > FileOUT.txt
set /P row=<FileIN.txt
:LOOP
for /f "tokens=1* delims=," %%a in ("%row%") do (
echo.%%a>> FileOUT.txt
set row=%%b
)
if not "%row%"=="" goto :LOOP
:: End_Of_Batch


Report Offensive Follow Up For Removal

Response Number 2
Name: learner
Date: March 25, 2008 at 05:43:33 Pacific
Subject: I need a .bat file!
Reply: (edit)
how can I use the above bat file. I have created a bat file but it is only creating two blank txt file named FileOUT & IN!

Report Offensive Follow Up For Removal

Response Number 3
Name: learner
Date: March 25, 2008 at 05:48:32 Pacific
Subject: I need a .bat file!
Reply: (edit)
Sorry, I have applied Batch file wrongly.....actually I have named one of the file In.....when I changed the name to FileIn then it works perfectly.......

Thanks IVO for this help.......:)


Report Offensive Follow Up For Removal

Response Number 4
Name: ghostdog
Date: March 25, 2008 at 06:12:25 Pacific
Subject: I need a .bat file!
Reply: (edit)
If you can download and install coreutils from here: http://gnuwin32.sourceforge.net/pac...


C:\test>type input.txt
jane,mike,peter
C:\test>tr "," "\n" < input.txt
jane
mike
peter
C:\test>

to save to a new file, just


c:\test> tr "," "\n" < input.txt > newfile


Report Offensive Follow Up For Removal

Response Number 5
Name: Mechanix2Go
Date: March 26, 2008 at 10:32:02 Pacific
Subject: I need a .bat file!
Reply: (edit)
Hi IVO,

Can you tell me why this echos the commas?

TIA

::==
@echo off
setLocal EnableDelayedExpansion

for /f "tokens=* delims=," %%d in (my.csv) do (
echo %%d
)


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: I need a .bat file!

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




Slow boot time

Trasnferring Documents from old HD

My k8T Neo-v usb's aren't working!

Date Modified = Date Created Time

system files on removable harddrive


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC