Text data is not converting into Excel data by using DOS.

November 10, 2014 at 02:14:56
Specs: Windows 7
I have text files of summary reports like this (example: ars_summary.txt,alarmer_summary.txt). here "ars,alarmer" are module names.
I need to consilidate these text files of summary reports to .csv file.
sample report of ars_summary.txt as below and same as well for alarmer_summary.txt file.

Count Type Number Text

61 Error 40 Undeclared identifier '___'
13 Error 52 Expected an lvalue
13 Error 63 Expected an lvalue
8 Error 85 Array '___' has dimension 0
8 Error 1008 In declaration of '___', did not expect '= ___'; text ignored
7 Error 1013 Symbol '___' not a member of class '___'
To convert these written script as below

@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

echo Module,Count,Type,Code,Violation >finalsummary.txt

dir /s /b *_summary.txt >filenames.txt

for /F "tokens=1 delims=$" %%i in (filenames.txt) do (
set name=%%~ni%
for /f "tokens=1,2 delims=_" %%x in ("!name!") do (
set ModuleName=%%x
)
type "%%i" | find /n "Count" >templinenumber.txt
for /f "tokens=1,2 delims=[" %%x in (templinenumber.txt) do (
for /f "tokens=1 delims=]" %%j in ("%%x") do (
set linenum=%%j%
set /a linenum=!linenum! + 1
more +!linenum! "%%i" >tempsummary.txt
for /f "tokens=1 delims=$ skip=1" %%i in (tempsummary.txt) do (
echo !ModuleName!,%%i>>finalsummary.txt
type finalsummary.txt > finalsummary.csv
)
)
)
)

after executing this script received output as like this

Module Count Type Code Violation
Alarmer 2 Error 19 Useless Declaration
Alarmer 34 Error 40 Undeclared identifier '___'
Alarmer 1 Error 64 Type mismatch (___) (___)
Alarmer 4 Error 85 Array '___' has dimension 0
Alarmer 66 Error 114 Inconsistent structure declaration for tag '___'
Alarmer 2 Error 129 declaration expected identifier '___' ignored
Alarmer 2 Error 309 ___
Alarmer 7 Error 1008 In declaration of '___' did not expect '= ___'; text ignored
expected result would be like this

Module Count Type Code ViolationCode Violation
Alarmer 8 Error 10 Error-10 Expecting ___
Alarmer 7 Error 1008 Error-1008 In declaration of '___', did not expect '= ___'; text ignored
ars 8 Error 1008 Error-1008 In declaration of '___', did not expect '= ___'; text ignored

the problem here is data allignment is not proper. can any one help how I can get exact data as per above.


See More: Text data is not converting into Excel data by using DOS.

Report •

#1
November 10, 2014 at 04:23:58
Hi,

issues has been resolved.


Report •
Related Solutions


Ask Question