Csv output editing through batch

Microsoft Windows xp professional w/serv...
September 9, 2010 at 20:41:46
Specs: Windows XP, 512
hi

thanks for allowing to participate in this forum....
i have a CSV file which is having following columns
PATH KEYNAME VALUENAME VALUETYPE LASTWRITETYPE
XX XX XX XX XX
XX XX XX XX XX
XX XX XX XX XX

This output which i got is after running a BATCH in a particular PC. Now i want to make some changes into my output so that it should look like

NODENAME PATH KEYNAME VALUENAME VALUETYPE LASTWRITETYPE
hostname XX XX XX XX XX
hosname XX XX XX XX XX
hosname XX XX XX XX XX

The hostname should be taken from PC name where i am running this batch file

any suggesstions in this regard is greatly appreciated
thanks in advance


See More: Csv output editing through batch

Report •


#1
September 10, 2010 at 01:03:06
Edited - deleted.

Report •

#2
September 10, 2010 at 01:04:54
@echo off & setLocal enableDELAYedeXpansion

set N=
for /f "tokens=* delims= " %%a in (my.csv) do (
set /a N+=1
if !N! equ 1 ( > new.csv echo.NODENAME %%a
) else (
>> new.csv echo.%computername% %%a )
)


=====================================
Helping others achieve escape felicity

M2


Report •

#3
September 10, 2010 at 02:06:18
Thank u very much.....for replying me in fastest manner............... this script reduced my most of the work....... one of the best forum..... i found so far....... keep it up!!!!!!!!!!!!!!!!!!

Report •

Related Solutions

#4
September 15, 2010 at 00:08:00
sorry i once again came for asking some change in the output so that it matches the database
now the output is
NODENAME PATH KEYNAME VALUENAME VALUETYPE LASTWRITETYPE
hostname XX XX XX XX XX
hostname XX XX XX XX XX
hostname XX XX XX XX XX

how can i make sure that hostname should be available in first row..... and not in other rows....
i.e
NODENAME PATH KEYNAME VALUENAME VALUETYPE LASTWRITETYPE
hostname XX XX XX XX XX
blank XX XX XX XX XX
blank XX XX XX XX XX


Report •


Ask Question