Page 1 of 3

Reading Columns & Output

Posted: 24 Jan 2013 20:17
by booga73
hello,

I've created this basic script:

FOR /F "eol=; tokens=1-8 delims= " %%i in (c:\temp1\FileCheck.txt) do @echo %%i %%j %%k %%l %%m %%n %%o %%p >> c:\temp1\fileOutPut.txt

I used this command to produce this output: dir /t:caw /r /x /q /a /o:-g-ds >> c:\FileCheck.txt

FileCheck.txt has the following data in the text.

01/10/2013 08:04 PM <DIR> MICROS~1 WINDOZE7\OWNER Microsoft
01/04/2013 09:22 PM <DIR> WINDOZE7\OWNER VOS
01/04/2013 08:38 PM <DIR> BUILTIN\Administrators Adobe
12/29/2012 01:25 PM <DIR> BUILTIN\Administrators Ipswitch
12/29/2012 01:25 PM <DIR> WINDOZE7\OWNER .
12/29/2012 01:25 PM <DIR> WINDOZE7\OWNER ..
12/27/2012 11:58 PM <DIR> ICACLI~1 BUILTIN\Administrators ICAClient
12/27/2012 10:29 PM <DIR> JUNIPE~1 BUILTIN\Administrators Juniper Networks
12/27/2012 10:24 PM <DIR> BUILTIN\Administrators NVIDIA
12/27/2012 10:09 PM <DIR> BUILTIN\Administrators Mozilla
12/27/2012 10:07 PM <DIR> MACROM~1 BUILTIN\Administrators Macromedia
12/27/2012 09:22 PM <DIR> MALWAR~1 BUILTIN\Administrators Malwarebytes
12/27/2012 09:17 PM <DIR> IDENTI~1 WINDOZE7\OWNER Identities
04/12/2011 01:45 AM <DIR> MEDIAC~1 WINDOZE7\OWNER Media Center Programs

But when I want to use my batch file from above to read the columns, all the empty space / alignment is off an the true columns are not intact / the same.
fileOutPut.txt shows the following:

01/10/2013 08:04 PM <DIR> MICROS~1 NEUBYTES\iremotetech Microsoft
01/04/2013 09:22 PM <DIR> NEUBYTES\iremotetech VOS
01/04/2013 08:38 PM <DIR> BUILTIN\Administrators Adobe
12/29/2012 01:25 PM <DIR> BUILTIN\Administrators Ipswitch
12/29/2012 01:25 PM <DIR> NEUBYTES\iremotetech .
12/29/2012 01:25 PM <DIR> NEUBYTES\iremotetech ..
12/27/2012 11:58 PM <DIR> ICACLI~1 BUILTIN\Administrators ICAClient
12/27/2012 10:29 PM <DIR> JUNIPE~1 BUILTIN\Administrators Juniper Networks
12/27/2012 10:24 PM <DIR> BUILTIN\Administrators NVIDIA
12/27/2012 10:09 PM <DIR> BUILTIN\Administrators Mozilla
12/27/2012 10:07 PM <DIR> MACROM~1 BUILTIN\Administrators Macromedia
12/27/2012 09:22 PM <DIR> MALWAR~1 BUILTIN\Administrators Malwarebytes
12/27/2012 09:17 PM <DIR> IDENTI~1 NEUBYTES\iremotetech Identities
04/12/2011 01:45 AM <DIR> MEDIAC~1 NEUBYTES\iremotetech Media Center

I need help with my for loop to help keep the spacing the same; I want to eventually output each column, each row, data into its own position, I am planning on outputting the data to html display.

Just how do I keep all the empty slots in the column or row from being filled with the next column or row of data spilling into the empty space?

Please let me know if you need additional input?

v/r Booga73

Re: Reading Columns & Output

Posted: 24 Jan 2013 20:22
by booga73
hmm, I think I need to use the following:

FOR /F "eol=; tokens=1-8 delims=*" %%i in (c:\temp1\FileCheck.txt) do @echo %%i %%j %%k %%l %%m %%n %%o %%p >> c:\temp1\fileOutPut.txt

????

Re: Reading Columns & Output

Posted: 24 Jan 2013 21:23
by booga73
I figured it out..... long day. . .

I used this option: delims=*

Re: Reading Columns & Output

Posted: 24 Jan 2013 22:04
by foxidrive
delims=* is going to change the delims to something that is not in the text.

You might be better off with something like this. Adjust the number of tokens to suit your regional settings but the * in the last token should be set to give you the rest of the line, after the owner token - so that it gives you the complete filename.

Code: Select all

@echo off
FOR /F "tokens=1-5,*" %%i in (c:\temp1\FileCheck.txt) do >> c:\temp1\fileOutPut.txt echo %%i %%j %%k %%l %%m %%n

Re: Reading Columns & Output

Posted: 24 Jan 2013 23:52
by suresh_knv
hi,

delims=* makes the delimiter for the tokens to * which is not in the file so it takes complete sentence in 1 token and it doesnt break in to columns

May be you may try this it works

@echo off
FOR /F "usebackq tokens=1-5,* delims=" %%i in ("c:\temp1\FileCheck.txt") do @echo %%i %%j %%k %%l %%m %%n >>c:\temp1\fileOutPut.txt

here the delimiter is space and and it makes 6 tokens for the 6 th token it completely takes the rest of the sentence

Re: Reading Columns & Output

Posted: 08 Feb 2013 14:50
by booga73
I still need help with proper parsing of text file, "myResults2.txt"; if you can please help, ty!

My apology for the timeliness to get back to my subject, Reading Columns & Output.

I have a text file listed below as "myResults2.txt". I generated that output with the following batch code:

initial batch program (copy & paste into your text file as needed)
:: ------------------------------------
:: beginning of batch file
@Echo off

c:
cd\
cd temp1
cls

dir c:\windows\ /t:caw /r /x /q /a /o:-g-ds > c:\temp1\WinDir0.txt
more +5 c:\temp1\WinDir0.txt > c:\temp1\WinDir1.txt
erase /s c:\temp1\WinDir0.txt
cls

:: code start to identify number of lines in a text
Set FileName=WinDir1.txt
Set /a LineNumb=0
for /f "tokens=2 delims=:" %%a in ('find /c /v "" %FileName%') do set /a LineNumb=%%a
rem Echo %FileName% has %LineNumb% lines. > c:\temp1\myResults.txt

:: code end to identify number of lines in a text

setlocal enabledelayedexpansion

SET /A maxlines=116
SET /A linecount=0

FOR /F "eol=; tokens=1-8* delims=," %%b IN (c:\temp1\WinDir1.txt) DO (
IF !linecount! EQU %maxlines% GOTO ExitLoop
ECHO %%b %%c %%d %%e %%f %%g %%h %%i >> c:\temp1\myResults2.txt
SET /A linecount+=1
)

:ExitLoop
erase /s c:\temp1\WinDir1.txt

sed 's/^[ ]*//g' c:\temp1\myResults2.txt |sed -e 's/\([0-9a-zA-Z\.]*\) */\1;/g' > input2.csv
:: pause
start hh c:\temp1\myResults2.txt
:: pause
:: erase /s c:\temp1\myResults2.txt

exit
:: end of batch file

:: ------------------------------------

the resulting text output, myResults2.txt, shows that all the data uniformally in it's own row /column. The initial help provided from previous posts were great and well suggested, thank you!

now though, I would like to take that file output, myResults2.txt, preserve the formatting ( how the columns appear and where there are spaces in the cell areas), preserve all that too.

For example, just for viewing, at the command prompt type the following: hh myresults2.txt, the results from the command "hh" opens up an HTML Help window that displays the contents of myresults2.txt.

My intended goal is to preserve all the column / row / cell positioning and spacing and instead of displaying the output of myresults2.txt, display the file as HTML in table form.

My question though, should the text file myResults2.txt be converted into delimented data seperated by a comma so that all the column / row / cell positioning and spacing be preserved?

I haven't been able to figure out the exact batch scripting to do that.

I found this code which thought would be useful to convert myResults2.txt to CSV which was thinking will preserve the needed column / row / cell positioning and spacing:

sed 's/^[ ]*//g' c:\temp1\myResults2.txt |sed -e 's/\([0-9a-zA-Z\.]*\) */\1;/g' > input2.csv

I get this error:


'sed' is not recognized as an internal or external command,
operable program or batch file.


Well, from the time of my last posting of my initial request, I had been busy and now returning back to my baby script here.

So, I would like to get my text file to uniformally display in html, but first need to see about the proper parsing and preservation of the data (myResults2.txt) file.

my myResults2.txt shows the following content:






02/08/2013 01:40 PM 1 357 490 WINDOW~1.LOG NT AUTHORITY\SYSTEM WindowsUpdate.log
02/08/2013 08:13 AM 497 NT AUTHORITY\SYSTEM SMSCFG.ini
02/08/2013 08:07 AM 58 182 NT AUTHORITY\SYSTEM setupact.log
02/08/2013 08:07 AM 67 584 NT AUTHORITY\SYSTEM bootstat.dat
01/28/2013 05:14 PM 50 400 BUILTIN\Administrators PFRO.log
01/11/2013 01:02 PM 265 002 MSXML4~4.LOG BUILTIN\Administrators msxml4-KB2758694-enu.LOG
01/07/2013 08:00 AM 267 292 MSXML4~3.LOG BUILTIN\Administrators msxml4-KB2721691-enu.LOG
01/03/2013 11:03 PM 289 566 MSXML4~2.LOG NT AUTHORITY\SYSTEM msxml4-KB973688-enu.LOG
01/02/2013 10:29 AM 4 400 MCAFEE~2.LOG BUILTIN\Administrators McAfeeHip7_Patch.log
01/02/2013 10:29 AM 2 124 628 MCAFEE~1.LOG BUILTIN\Administrators McAfeeHip7_Install.log
12/13/2012 08:32 AM 11 536 NT AUTHORITY\SYSTEM iis7.log
11/27/2012 11:57 AM 1 315 DFSRAD~1.CON BUILTIN\Administrators DfsrAdmin.exe.config
11/27/2012 10:10 AM 503 930 BUILTIN\Administrators ntbtlog.txt
11/26/2012 09:02 AM 478 NT AUTHORITY\SYSTEM win.ini
11/20/2012 07:16 AM 290 870 MSXML4~1.LOG NT AUTHORITY\SYSTEM msxml4-KB954430-enu.LOG
11/19/2012 12:35 PM 13 118 PRODUC~1.XSD BUILTIN\Administrators ProductRegistry.xsd
11/19/2012 12:35 PM 1 432 PRODUC~1.XML BUILTIN\Administrators ProductRegistry.xml
11/19/2012 11:56 AM 5 776 TSSYSP~1.LOG NT AUTHORITY\SYSTEM TSSysprep.log
11/19/2012 11:54 AM 3 806 DTCINS~1.LOG NT AUTHORITY\SYSTEM DtcInstall.log
10/14/2011 10:51 AM 61 650 NT AUTHORITY\SYSTEM DPINST.LOG
06/08/2011 10:50 AM 1 062 BUILTIN\Administrators xpsp1hfm.log
05/31/2011 10:47 AM 2 526 SECEDI~1.TXT NT AUTHORITY\SYSTEM secedit-command-log.txt
05/31/2011 10:46 AM 51 NT AUTHORITY\SYSTEM smsts.ini
02/24/2011 11:30 PM 2 616 320 NT SERVICE\TrustedInstaexplorer.exe
11/20/2010 06:21 AM 51 200 NT SERVICE\TrustedInstatwain_32.dll
11/20/2010 06:16 AM 65 024 NT SERVICE\TrustedInstabfsvc.exe
09/18/2009 02:00 AM 19 824 NT AUTHORITY\SYSTEM ISMIF32.dll
08/04/2009 11:56 AM 296 960 NT SERVICE\TrustedInstawinhlp32.exe
07/13/2009 10:41 PM 749 WINDOW~1.MAN NT AUTHORITY\SYSTEM WindowsShell.Manifest
07/13/2009 10:39 PM 0 NT AUTHORITY\SYSTEM setuperr.log
07/13/2009 07:19 PM 258 048 NT SERVICE\TrustedInstaDfsrAdmin.exe
07/13/2009 07:14 PM 9 216 NT SERVICE\TrustedInstawrite.exe
07/13/2009 07:14 PM 31 232 NT SERVICE\TrustedInstatwunk_32.exe
07/13/2009 07:14 PM 398 336 NT SERVICE\TrustedInstaregedit.exe
07/13/2009 07:14 PM 179 712 NT SERVICE\TrustedInstanotepad.exe
07/13/2009 07:14 PM 15 360 NT SERVICE\TrustedInstahh.exe
07/13/2009 07:14 PM 497 152 NT SERVICE\TrustedInstaHelpPane.exe
07/13/2009 07:14 PM 13 824 NT SERVICE\TrustedInstafveupdate.exe
07/13/2009 04:58 PM 43 131 NT SERVICE\TrustedInstamib.bin
06/10/2009 03:46 PM 219 NT AUTHORITY\SYSTEM system.ini
06/10/2009 03:42 PM 707 NT SERVICE\TrustedInsta_default.pif
06/10/2009 03:42 PM 256 192 NT SERVICE\TrustedInstawinhelp.exe
06/10/2009 03:41 PM 49 680 NT SERVICE\TrustedInstatwunk_16.exe
06/10/2009 03:41 PM 94 784 NT SERVICE\TrustedInstatwain.dll
06/10/2009 03:34 PM 316 640 NT SERVICE\TrustedInstaWMSysPr9.prx
06/10/2009 03:19 PM 1 405 NT AUTHORITY\SYSTEM msdfmap.ini
06/10/2009 03:14 PM 48 201 NT AUTHORITY\SYSTEM Starter.xml
06/10/2009 03:14 PM 53 555 ENTERP~1.XML BUILTIN\Administrators Enterprise.xml
05/02/2009 02:42 AM 41 078 BUILTIN\Administrators DODc.bmp
11/27/2006 09:58 AM 1 164 294 WALL-U~1.BMP BUILTIN\Administrators Wall-Unclass.bmp
02/08/2013 02:03 PM <DIR> BUILTIN\Administrators Temp
02/08/2013 08:08 AM <DIR> NT SERVICE\TrustedInstaSystem32
02/07/2013 02:20 PM <DIR> NT SERVICE\TrustedInstainf
01/29/2013 12:05 PM <DIR> MODEML~1 BUILTIN\Administrators ModemLogs
01/28/2013 06:11 PM <DIR> NT SERVICE\TrustedInsta.
01/28/2013 06:11 PM <DIR> NT SERVICE\TrustedInsta..
01/23/2013 04:27 PM <DIR> BUILTIN\Administrators Prefetch
01/16/2013 09:20 AM <DIR> INSTAL~1 BUILTIN\Administrators Installer
01/15/2013 03:08 PM <DIR> BUILTIN\Administrators Tasks
01/15/2013 10:52 AM <DIR> NT SERVICE\TrustedInstawinsxs
01/14/2013 08:29 AM <DIR> MICROS~1.NET NT SERVICE\TrustedInstaMicrosoft.NET
01/14/2013 08:29 AM <DIR> BUILTIN\Administrators assembly
12/21/2012 11:05 AM <DIR> RESOUR~1 NT SERVICE\TrustedInstaResources
12/13/2012 08:18 AM <DIR> NT SERVICE\TrustedInstaCluster
12/13/2012 08:18 AM <DIR> MIGRAT~1 NT AUTHORITY\SYSTEM Migration
12/13/2012 08:18 AM <DIR> POLICY~1 NT SERVICE\TrustedInstaPolicyDefinitions
12/12/2012 04:06 PM <DIR> NT SERVICE\TrustedInstaAppPatch
11/27/2012 11:57 AM <DIR> BUILTIN\Administrators Logs
11/27/2012 11:57 AM <DIR> NT SERVICE\TrustedInstaADAM
11/27/2012 11:57 AM <DIR> NT AUTHORITY\SYSTEM idmu
11/27/2012 11:57 AM <DIR> BUILTIN\Administrators Help
11/27/2012 10:20 AM <DIR> BUILTIN\Administrators pss
11/27/2012 09:41 AM <DIR> DOWNLO~1 NT SERVICE\TrustedInstaDownloaded Program Files
11/26/2012 09:22 AM <DIR> NT SERVICE\TrustedInstaFonts
11/19/2012 12:49 PM <DIR> SOFTWA~1 NT AUTHORITY\SYSTEM SoftwareDistribution
11/19/2012 12:00 PM <DIR> NT AUTHORITY\SYSTEM Panther
11/19/2012 12:00 PM <DIR> NT SERVICE\TrustedInstarescache
04/03/2012 12:19 PM <DIR> REGIST~1 BUILTIN\Administrators Registration
10/14/2011 10:52 AM <DIR> NT SERVICE\TrustedInstasystem
08/12/2011 02:46 PM <DIR> NT AUTHORITY\SYSTEM ms
08/12/2011 02:45 PM <DIR> BUILTIN\Administrators Sun
08/12/2011 01:28 PM <DIR> BUILTIN\Administrators nvmup
06/23/2011 11:07 AM <DIR> NT AUTHORITY\SYSTEM debug
06/02/2011 03:34 PM <DIR> DOWNLO~2 BUILTIN\Administrators Downloaded Installations
05/31/2011 03:45 PM <DIR> SERVIC~1 NT SERVICE\TrustedInstaservicing
05/31/2011 03:45 PM <DIR> BITLOC~1 NT SERVICE\TrustedInstaBitLockerDiscoveryVolumeContents
05/31/2011 01:37 PM <DIR> NT AUTHORITY\SYSTEM CSC
05/31/2011 11:22 AM <DIR> NT SERVICE\TrustedInstaShellNew
05/31/2011 11:16 AM <DIR> NT AUTHORITY\SYSTEM PCHEALTH
02/16/2011 08:44 PM <DIR> NT SERVICE\TrustedInstaen-US
02/16/2011 07:38 PM <DIR> NT AUTHORITY\SYSTEM Setup
07/14/2009 01:22 AM <DIR> GLOBAL~1 NT SERVICE\TrustedInstaGlobalization
07/14/2009 01:20 AM <DIR> NT SERVICE\TrustedInstasecurity
07/14/2009 01:20 AM <DIR> REMOTE~1 BUILTIN\Administrators RemotePackages
07/13/2009 10:56 PM <DIR> DIGITA~1 NT AUTHORITY\SYSTEM DigitalLocker
07/13/2009 10:56 PM <DIR> NT SERVICE\TrustedInstaIME
07/13/2009 10:56 PM <DIR> BUILTIN\Administrators Speech
07/13/2009 10:52 PM <DIR> OFFLIN~1 NT SERVICE\TrustedInstaOffline Web Pages
07/13/2009 10:52 PM <DIR> NT SERVICE\TrustedInstaMedia
07/13/2009 10:52 PM <DIR> NT SERVICE\TrustedInstatwain_32
07/13/2009 10:52 PM <DIR> L2SCHE~1 NT SERVICE\TrustedInstaL2Schemas
07/13/2009 10:52 PM <DIR> NT SERVICE\TrustedInstaCursors
07/13/2009 10:52 PM <DIR> NT SERVICE\TrustedInstaBranding
07/13/2009 10:52 PM <DIR> NT SERVICE\TrustedInstaBoot
07/13/2009 10:52 PM <DIR> DIAGNO~1 NT SERVICE\TrustedInstadiagnostics
07/13/2009 10:52 PM <DIR> NT SERVICE\TrustedInstaWeb
07/13/2009 10:52 PM <DIR> NT SERVICE\TrustedInstaschemas
07/13/2009 10:52 PM <DIR> PERFOR~1 NT SERVICE\TrustedInstaPerformance
07/13/2009 10:46 PM <DIR> BUILTIN\Administrators TAPI
07/13/2009 10:34 PM <DIR> SERVIC~2 BUILTIN\Administrators ServiceProfiles
07/13/2009 08:37 PM <DIR> BUILTIN\Administrators Vss
07/13/2009 08:37 PM <DIR> BUILTIN\Administrators PLA
07/13/2009 08:37 PM <DIR> APPCOM~1 BUILTIN\Administrators AppCompat
07/13/2009 08:05 PM <DIR> BUILTIN\Administrators SchCache
07/13/2009 08:04 PM <DIR> BUILTIN\Administrators tracing
07/13/2009 08:03 PM <DIR> LIVEKE~1 BUILTIN\Administrators LiveKernelReports

Re: Reading Columns & Output

Posted: 08 Feb 2013 16:50
by abc0502
SED is an external Tool "3rd Party Tool", you will have to install the windows version in order to work with you.

If it possible, can you post a sample of the output that you wish to have, i don't get exactly what you need to do :oops:

Re: Reading Columns & Output

Posted: 08 Feb 2013 18:53
by booga73
Hi abc0502,

Will post soon, thank you for your quick reply.

best regards, Booga73

Re: Reading Columns & Output

Posted: 08 Feb 2013 21:02
by foxidrive
If you just want to separate the last field for displaying (because the security field runs into the filename field) then try this:

Code: Select all

:: ------------------------------------
:: beginning of batch file
@Echo off

md c:\temp1 2>nul
cd /d c:\temp1
cls

dir c:\windows\ /t:caw /r /x /q /a /o:-g-ds |find "/"  > WinDir1.txt

:: code start to identify number of lines in a text
Set FileName=WinDir1.txt
Set /a LineNumb=0
for /f %%a in ('find /c /v "" ^< %FileName%') do set /a LineNumb=%%a
rem Echo %FileName% has %LineNumb% lines. > myResults.txt

:: code end to identify number of lines in a text

setlocal enabledelayedexpansion

SET /A maxlines=116
SET /A linecount=0

del myResults2.txt 2>nul

FOR /F "delims=" %%b IN (WinDir1.txt) DO (
IF !linecount! EQU %maxlines% GOTO ExitLoop
set "field=%%b"
>> myResults2.txt ECHO !field:~0,75! !field:~75!
SET /A linecount+=1
)

:ExitLoop
del WinDir1.txt

:: sed 's/^[ ]*//g' myResults2.txt |sed -e 's/\([0-9a-zA-Z\.]*\) */\1;/g' > input2.csv
:: pause
start hh myResults2.txt
:: pause
:: del myResults2.txt

exit
:: end of batch file

:: ------------------------------------


It gives me this (when the date separator is a / character )

Code: Select all

09/02/2013  10:45 AM         1,423,741 WINDOW~1.LOG NT AUTHORITY\SYSTEM     WindowsUpdate.log
05/02/2013  01:50 AM            67,584              NT AUTHORITY\SYSTEM     bootstat.dat
05/02/2013  01:48 AM         1,604,476              NT AUTHORITY\SYSTEM     setupact.log
03/02/2013  10:45 PM             9,556              BUILTIN\Administrators  PFRO.log
29/01/2013  09:19 PM            17,510              BUILTIN\Administrators  wincmd.ini
06/11/2012  03:20 PM           788,480              NT SERVICE\TrustedInsta HelpPane.exe
03/11/2012  01:46 AM            22,863              ...                     diagerr.xml
03/11/2012  01:46 AM            22,863              ...                     diagwrn.xml
03/11/2012  01:46 AM             6,633              BUILTIN\Administrators  comsetup.log
03/11/2012  01:44 AM             3,960 DTCINS~1.LOG NT AUTHORITY\SYSTEM     DtcInstall.log
03/11/2012  01:43 AM                 0              BUILTIN\Administrators  ativpsrm.bin
03/11/2012  01:13 AM         1,367,641 WINDOW~2.LOG BUILTIN\Administrators  WindowsUpdate (1).log
03/11/2012  01:08 AM             1,945 EPPLAU~1.MIF BUILTIN\Administrators  epplauncher.mif
01/11/2012  02:07 PM             4,578              BUILTIN\Administrators  wcx_ftp.ini
11/10/2012  04:56 PM         2,115,952              NT SERVICE\TrustedInsta explorer.exe
01/10/2012  09:57 AM               453              BUILTIN\Administrators  INSTALL.LOG
31/08/2012  12:32 AM                63 ALTAIR~1.INI BUILTIN\Administrators  Altair_1.250.INI
02/08/2012  04:27 AM           917,748              BUILTIN\Administrators  ntbtlog.txt
26/07/2012  05:09 PM             1,585 VMGCOI~1.LOG NT AUTHORITY\SYSTEM     vmgcoinstall.log
26/07/2012  05:03 PM                 0              NT AUTHORITY\SYSTEM     setuperr.log
26/07/2012  03:17 PM               219              NT AUTHORITY\SYSTEM     system.ini
26/07/2012  02:21 PM             9,728              NT SERVICE\TrustedInsta write.exe
26/07/2012  02:21 PM            10,752              NT SERVICE\TrustedInsta winhlp32.exe
26/07/2012  02:20 PM            30,208              NT SERVICE\TrustedInsta twunk_32.exe
26/07/2012  02:20 PM           109,056              NT SERVICE\TrustedInsta splwow64.exe
26/07/2012  02:20 PM           133,120              NT SERVICE\TrustedInsta regedit.exe
26/07/2012  02:20 PM           233,984              NT SERVICE\TrustedInsta notepad.exe
26/07/2012  02:20 PM            15,872              NT SERVICE\TrustedInsta hh.exe
26/07/2012  02:20 PM            68,608              NT SERVICE\TrustedInsta bfsvc.exe
26/07/2012  02:20 PM            50,176              NT SERVICE\TrustedInsta twain_32.dll
26/07/2012  07:41 AM            43,131              NT SERVICE\TrustedInsta mib.bin
26/07/2012  07:18 AM            15,901 PROFES~2.XML BUILTIN\Administrators  ProfessionalWMC.xml
26/07/2012  07:18 AM            15,769              NT AUTHORITY\SYSTEM     Starter.xml
26/07/2012  07:18 AM            15,941 PROFES~1.XML BUILTIN\Administrators  Professional.xml
20/07/2012  02:02 AM               152              BUILTIN\Administrators  pkplugin.ini
15/07/2012  01:27 PM         2,216,480              BUILTIN\Administrators  wweb32.dll
18/06/2012  01:35 AM         2,456,576 {DE779~1     BUILTIN\Administrators  {DE779690-B876-11E1-8273-00241D23F809}
17/06/2012  10:27 PM         1,851,904 {C3621~1     BUILTIN\Administrators  {C3621EC7-B86B-11E1-80AB-00241D23F809}
03/06/2012  01:46 AM               707              NT SERVICE\TrustedInsta _default.pif
03/06/2012  01:46 AM           256,192              NT SERVICE\TrustedInsta winhelp.exe
03/06/2012  01:37 AM            49,680              NT SERVICE\TrustedInsta twunk_16.exe
03/06/2012  01:37 AM            94,784              NT SERVICE\TrustedInsta twain.dll
03/06/2012  01:34 AM           316,640              NT SERVICE\TrustedInsta WMSysPr9.prx
03/06/2012  01:32 AM               670              NT SERVICE\TrustedInsta WindowsShell.Manifest
17/05/2012  04:24 PM               793              ...                     XXCLONE.INI
12/05/2012  06:53 PM               303              BUILTIN\Administrators  SynInst.log
12/05/2012  06:21 PM             1,355 TSSYSP~1.LOG NT AUTHORITY\SYSTEM     TSSysprep.log
09/03/2012  08:57 AM               545              BUILTIN\Administrators  PKUNZIP.PIF
09/03/2012  08:57 AM               545              BUILTIN\Administrators  PKZIP.PIF
09/03/2012  08:57 AM               545              BUILTIN\Administrators  NOCLOSE.PIF
09/03/2012  08:57 AM               545              BUILTIN\Administrators  RAR.PIF
09/03/2012  08:57 AM               545              BUILTIN\Administrators  ARJ.PIF
09/03/2012  08:57 AM               545              BUILTIN\Administrators  LHA.PIF
09/03/2012  08:57 AM               545              BUILTIN\Administrators  UC.PIF
18/06/2011  06:03 AM                66              BUILTIN\Administrators  W7T.txt
14/07/2009  03:54 PM               403              NT AUTHORITY\SYSTEM     win.ini
14/07/2009  12:14 PM             9,728              NT SERVICE\TrustedInsta winhlp32.exe.org
11/06/2009  08:19 AM             1,405              NT AUTHORITY\SYSTEM     msdfmap.ini
09/02/2013  08:52 AM    <DIR>                       ...                     Prefetch
09/02/2013  03:02 AM    <DIR>                       ...                     Temp
09/02/2013  03:00 AM    <DIR>          MICROS~1.NET NT SERVICE\TrustedInsta Microsoft.NET
08/02/2013  12:46 PM    <DIR>                       NT AUTHORITY\SYSTEM     CbsTemp
08/02/2013  12:46 PM    <DIR>                       NT SERVICE\TrustedInsta WinSxS
08/02/2013  12:46 PM    <DIR>                       NT SERVICE\TrustedInsta System32
07/02/2013  01:39 AM    <DIR>          INSTAL~1     BUILTIN\Administrators  Installer
05/02/2013  10:57 PM    <DIR>          AUINST~1     ...                     AUInstallAgent
05/02/2013  09:07 AM    <DIR>                       NT SERVICE\TrustedInsta inf
28/01/2013  06:38 PM    <DIR>                       NT SERVICE\TrustedInsta twain_32
28/01/2013  06:38 PM    <DIR>                       BUILTIN\Administrators  medias
28/01/2013  06:38 PM    <DIR>                       NT SERVICE\TrustedInsta .
28/01/2013  06:38 PM    <DIR>                       NT SERVICE\TrustedInsta ..
27/01/2013  03:00 AM    <DIR>                       NT AUTHORITY\SYSTEM     assembly
21/01/2013  06:26 AM    <DIR>                       NT SERVICE\TrustedInsta Fonts
13/01/2013  08:21 PM    <DIR>                       NT SERVICE\TrustedInsta rescache
13/01/2013  06:20 PM    <DIR>                       NT SERVICE\TrustedInsta WinStore
13/01/2013  06:20 PM    <DIR>                       NT SERVICE\TrustedInsta ehome
28/12/2012  01:38 PM    <DIR>          TOASTD~1     NT SERVICE\TrustedInsta ToastData
18/12/2012  11:16 AM    <DIR>                       NT AUTHORITY\SYSTEM     Logs
13/12/2012  02:58 PM    <DIR>                       NT AUTHORITY\SYSTEM     debug
02/12/2012  03:26 AM    <DIR>                       ...                     Minidump
01/12/2012  06:48 PM    <DIR>                       NT AUTHORITY\SYSTEM     Tasks
01/12/2012  06:48 PM    <DIR>          REGIST~2     BUILTIN\Administrators  registration
01/12/2012  08:22 AM    <DIR>                       NT SERVICE\TrustedInsta apppatch
22/11/2012  02:37 AM    <DIR>          POLICY~1     NT SERVICE\TrustedInsta PolicyDefinitions
03/11/2012  04:30 AM    <DIR>          IMMERS~1     NT SERVICE\TrustedInsta ImmersiveControlPanel
03/11/2012  04:28 AM    <DIR>          SOFTWA~1     BUILTIN\Administrators  SoftwareDistribution
03/11/2012  01:50 AM    <DIR>                       NT AUTHORITY\SYSTEM     Panther
03/11/2012  01:46 AM    <DIR>                       NT SERVICE\TrustedInsta Media
03/11/2012  01:45 AM    <DIR>          DOWNLO~1     NT SERVICE\TrustedInsta Downloaded Program Files
03/11/2012  01:44 AM    <DIR>                       NT SERVICE\TrustedInsta schemas
03/11/2012  01:43 AM    <DIR>          LIVEKE~1     ...                     LiveKernelReports
12/08/2012  09:38 AM    <DIR>                       BUILTIN\Administrators  Sun
26/07/2012  07:27 PM    <DIR>                       NT SERVICE\TrustedInsta ShellNew
26/07/2012  07:27 PM    <DIR>                       NT SERVICE\TrustedInsta SKB
26/07/2012  07:27 PM    <DIR>          BITLOC~1     NT SERVICE\TrustedInsta BitLockerDiscoveryVolumeContents
26/07/2012  07:27 PM    <DIR>                       NT SERVICE\TrustedInsta security
26/07/2012  07:23 PM    <DIR>          DIGITA~1     NT AUTHORITY\SYSTEM     DigitalLocker
26/07/2012  07:23 PM    <DIR>          SERVIC~1     NT SERVICE\TrustedInsta servicing
26/07/2012  07:23 PM    <DIR>                       NT AUTHORITY\SYSTEM     en-GB
26/07/2012  07:23 PM    <DIR>                       NT SERVICE\TrustedInsta IME
26/07/2012  07:23 PM    <DIR>                       NT SERVICE\TrustedInsta en-US
26/07/2012  07:23 PM    <DIR>                       NT AUTHORITY\SYSTEM     Help
26/07/2012  05:53 PM    <DIR>          L2SCHE~1     NT SERVICE\TrustedInsta L2Schemas
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta addins
26/07/2012  05:53 PM    <DIR>          DESKTO~1     NT SERVICE\TrustedInsta DesktopTileResources
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta System
26/07/2012  05:53 PM    <DIR>          OFFLIN~1     NT SERVICE\TrustedInsta Offline Web Pages
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Cursors
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     SchCache
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Branding
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Boot
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     TAPI
26/07/2012  05:53 PM    <DIR>          MODEML~1     ...                     ModemLogs
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     ELAMBKUP
26/07/2012  05:53 PM    <DIR>          RESOUR~1     NT SERVICE\TrustedInsta Resources
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Web

Re: Reading Columns & Output

Posted: 08 Feb 2013 21:04
by foxidrive
and if you use this line it sorts on the security field:

dir c:\windows\ /t:caw /r /x /q /a /o:-g-ds |find "/" |sort /+53 > WinDir1.txt


Code: Select all

05/02/2013  10:57 PM    <DIR>          AUINST~1     ...                     AUInstallAgent
03/11/2012  01:46 AM            22,863              ...                     diagerr.xml
03/11/2012  01:46 AM            22,863              ...                     diagwrn.xml
03/11/2012  01:43 AM    <DIR>          LIVEKE~1     ...                     LiveKernelReports
02/12/2012  03:26 AM    <DIR>                       ...                     Minidump
26/07/2012  05:53 PM    <DIR>          MODEML~1     ...                     ModemLogs
09/02/2013  08:52 AM    <DIR>                       ...                     Prefetch
09/02/2013  03:02 AM    <DIR>                       ...                     Temp
17/05/2012  04:24 PM               793              ...                     XXCLONE.INI
17/06/2012  10:27 PM         1,851,904 {C3621~1     BUILTIN\Administrators  {C3621EC7-B86B-11E1-80AB-00241D23F809}
18/06/2012  01:35 AM         2,456,576 {DE779~1     BUILTIN\Administrators  {DE779690-B876-11E1-8273-00241D23F809}
31/08/2012  12:32 AM                63 ALTAIR~1.INI BUILTIN\Administrators  Altair_1.250.INI
09/03/2012  08:57 AM               545              BUILTIN\Administrators  ARJ.PIF
03/11/2012  01:43 AM                 0              BUILTIN\Administrators  ativpsrm.bin
03/11/2012  01:46 AM             6,633              BUILTIN\Administrators  comsetup.log
12/05/2012  06:18 PM    <DIR>                       BUILTIN\Administrators  CSC
03/11/2012  01:08 AM             1,945 EPPLAU~1.MIF BUILTIN\Administrators  epplauncher.mif
01/10/2012  09:57 AM               453              BUILTIN\Administrators  INSTALL.LOG
07/02/2013  01:39 AM    <DIR>          INSTAL~1     BUILTIN\Administrators  Installer
09/03/2012  08:57 AM               545              BUILTIN\Administrators  LHA.PIF
28/01/2013  06:38 PM    <DIR>                       BUILTIN\Administrators  medias
09/03/2012  08:57 AM               545              BUILTIN\Administrators  NOCLOSE.PIF
02/08/2012  04:27 AM           917,748              BUILTIN\Administrators  ntbtlog.txt
03/02/2013  10:45 PM             9,556              BUILTIN\Administrators  PFRO.log
20/07/2012  02:02 AM               152              BUILTIN\Administrators  pkplugin.ini
09/03/2012  08:57 AM               545              BUILTIN\Administrators  PKUNZIP.PIF
09/03/2012  08:57 AM               545              BUILTIN\Administrators  PKZIP.PIF
26/07/2012  07:18 AM            15,941 PROFES~1.XML BUILTIN\Administrators  Professional.xml
26/07/2012  07:18 AM            15,901 PROFES~2.XML BUILTIN\Administrators  ProfessionalWMC.xml
09/03/2012  08:57 AM               545              BUILTIN\Administrators  RAR.PIF
01/12/2012  06:48 PM    <DIR>          REGIST~2     BUILTIN\Administrators  registration
21/11/2010  11:46 AM    <DIR>          REMOTE~1     BUILTIN\Administrators  RemotePackages
26/07/2012  05:00 PM    <DIR>          SERVIC~2     BUILTIN\Administrators  ServiceProfiles
03/11/2012  04:28 AM    <DIR>          SOFTWA~1     BUILTIN\Administrators  SoftwareDistribution
12/08/2012  09:38 AM    <DIR>                       BUILTIN\Administrators  Sun
12/05/2012  06:53 PM               303              BUILTIN\Administrators  SynInst.log
09/03/2012  08:57 AM               545              BUILTIN\Administrators  UC.PIF
18/06/2011  06:03 AM                66              BUILTIN\Administrators  W7T.txt
01/11/2012  02:07 PM             4,578              BUILTIN\Administrators  wcx_ftp.ini
29/01/2013  09:19 PM            17,510              BUILTIN\Administrators  wincmd.ini
03/11/2012  01:13 AM         1,367,641 WINDOW~2.LOG BUILTIN\Administrators  WindowsUpdate (1).log
15/07/2012  01:27 PM         2,216,480              BUILTIN\Administrators  wweb32.dll
26/07/2012  05:53 PM    <DIR>          APPCOM~1     NT AUTHORITY\SYSTEM     AppCompat
27/01/2013  03:00 AM    <DIR>                       NT AUTHORITY\SYSTEM     assembly
05/02/2013  01:50 AM            67,584              NT AUTHORITY\SYSTEM     bootstat.dat
08/02/2013  12:46 PM    <DIR>                       NT AUTHORITY\SYSTEM     CbsTemp
13/12/2012  02:58 PM    <DIR>                       NT AUTHORITY\SYSTEM     debug
26/07/2012  07:23 PM    <DIR>          DIGITA~1     NT AUTHORITY\SYSTEM     DigitalLocker
03/11/2012  01:44 AM             3,960 DTCINS~1.LOG NT AUTHORITY\SYSTEM     DtcInstall.log
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     ELAMBKUP
26/07/2012  07:23 PM    <DIR>                       NT AUTHORITY\SYSTEM     en-GB
26/07/2012  07:23 PM    <DIR>                       NT AUTHORITY\SYSTEM     Help
18/12/2012  11:16 AM    <DIR>                       NT AUTHORITY\SYSTEM     Logs
11/06/2009  08:19 AM             1,405              NT AUTHORITY\SYSTEM     msdfmap.ini
03/11/2012  01:50 AM    <DIR>                       NT AUTHORITY\SYSTEM     Panther
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     PLA
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     SchCache
26/07/2012  05:00 PM    <DIR>                       NT AUTHORITY\SYSTEM     Setup
05/02/2013  01:48 AM         1,604,476              NT AUTHORITY\SYSTEM     setupact.log
26/07/2012  05:03 PM                 0              NT AUTHORITY\SYSTEM     setuperr.log
26/07/2012  07:18 AM            15,769              NT AUTHORITY\SYSTEM     Starter.xml
26/07/2012  03:17 PM               219              NT AUTHORITY\SYSTEM     system.ini
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     TAPI
01/12/2012  06:48 PM    <DIR>                       NT AUTHORITY\SYSTEM     Tasks
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     tracing
12/05/2012  06:21 PM             1,355 TSSYSP~1.LOG NT AUTHORITY\SYSTEM     TSSysprep.log
26/07/2012  05:09 PM             1,585 VMGCOI~1.LOG NT AUTHORITY\SYSTEM     vmgcoinstall.log
26/07/2012  05:53 PM    <DIR>                       NT AUTHORITY\SYSTEM     Vss
14/07/2009  03:54 PM               403              NT AUTHORITY\SYSTEM     win.ini
09/02/2013  10:45 AM         1,423,741 WINDOW~1.LOG NT AUTHORITY\SYSTEM     WindowsUpdate.log
28/01/2013  06:38 PM    <DIR>                       NT SERVICE\TrustedInsta .
28/01/2013  06:38 PM    <DIR>                       NT SERVICE\TrustedInsta ..
03/06/2012  01:46 AM               707              NT SERVICE\TrustedInsta _default.pif
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta addins
01/12/2012  08:22 AM    <DIR>                       NT SERVICE\TrustedInsta apppatch
26/07/2012  02:20 PM            68,608              NT SERVICE\TrustedInsta bfsvc.exe
26/07/2012  07:27 PM    <DIR>          BITLOC~1     NT SERVICE\TrustedInsta BitLockerDiscoveryVolumeContents
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Boot
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Branding
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Cursors
26/07/2012  05:53 PM    <DIR>          DESKTO~1     NT SERVICE\TrustedInsta DesktopTileResources
26/07/2012  05:53 PM    <DIR>          DIAGNO~1     NT SERVICE\TrustedInsta diagnostics
03/11/2012  01:45 AM    <DIR>          DOWNLO~1     NT SERVICE\TrustedInsta Downloaded Program Files
13/01/2013  06:20 PM    <DIR>                       NT SERVICE\TrustedInsta ehome
26/07/2012  07:23 PM    <DIR>                       NT SERVICE\TrustedInsta en-US
11/10/2012  04:56 PM         2,115,952              NT SERVICE\TrustedInsta explorer.exe
21/01/2013  06:26 AM    <DIR>                       NT SERVICE\TrustedInsta Fonts
26/07/2012  05:53 PM    <DIR>          GLOBAL~1     NT SERVICE\TrustedInsta Globalization
06/11/2012  03:20 PM           788,480              NT SERVICE\TrustedInsta HelpPane.exe
26/07/2012  02:20 PM            15,872              NT SERVICE\TrustedInsta hh.exe
26/07/2012  07:23 PM    <DIR>                       NT SERVICE\TrustedInsta IME
03/11/2012  04:30 AM    <DIR>          IMMERS~1     NT SERVICE\TrustedInsta ImmersiveControlPanel
05/02/2013  09:07 AM    <DIR>                       NT SERVICE\TrustedInsta inf
26/07/2012  05:53 PM    <DIR>          L2SCHE~1     NT SERVICE\TrustedInsta L2Schemas
03/11/2012  01:46 AM    <DIR>                       NT SERVICE\TrustedInsta Media
26/07/2012  07:41 AM            43,131              NT SERVICE\TrustedInsta mib.bin
09/02/2013  03:00 AM    <DIR>          MICROS~1.NET NT SERVICE\TrustedInsta Microsoft.NET
26/07/2012  02:20 PM           233,984              NT SERVICE\TrustedInsta notepad.exe
26/07/2012  05:53 PM    <DIR>          OFFLIN~1     NT SERVICE\TrustedInsta Offline Web Pages
26/07/2012  05:53 PM    <DIR>          PERFOR~1     NT SERVICE\TrustedInsta Performance
22/11/2012  02:37 AM    <DIR>          POLICY~1     NT SERVICE\TrustedInsta PolicyDefinitions
26/07/2012  02:20 PM           133,120              NT SERVICE\TrustedInsta regedit.exe
13/01/2013  08:21 PM    <DIR>                       NT SERVICE\TrustedInsta rescache
26/07/2012  05:53 PM    <DIR>          RESOUR~1     NT SERVICE\TrustedInsta Resources
03/11/2012  01:44 AM    <DIR>                       NT SERVICE\TrustedInsta schemas
26/07/2012  07:27 PM    <DIR>                       NT SERVICE\TrustedInsta security
26/07/2012  07:23 PM    <DIR>          SERVIC~1     NT SERVICE\TrustedInsta servicing
26/07/2012  07:27 PM    <DIR>                       NT SERVICE\TrustedInsta ShellNew
26/07/2012  07:27 PM    <DIR>                       NT SERVICE\TrustedInsta SKB
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta Speech
26/07/2012  02:20 PM           109,056              NT SERVICE\TrustedInsta splwow64.exe
26/07/2012  05:53 PM    <DIR>                       NT SERVICE\TrustedInsta System
08/02/2013  12:46 PM    <DIR>                       NT SERVICE\TrustedInsta System32
28/12/2012  01:38 PM    <DIR>          TOASTD~1     NT SERVICE\TrustedInsta ToastData
03/06/2012  01:37 AM            94,784              NT SERVICE\TrustedInsta twain.dll
28/01/2013  06:38 PM    <DIR>                       NT SERVICE\TrustedInsta twain_32

Re: Reading Columns & Output

Posted: 08 Feb 2013 22:40
by Ocalabob
Greetings booga73,

As abc0502 pointed out you will need SED that has been ported for Windows.
In addition, you will need to replace those single quotes with double
quotes for the SED line to work with your Windows input file.

Code: Select all

SED "s/^[ ]*//g" myResults2.txt |SED -e "s/\([0-9a-zA-Z\.]*\) */\1;/g">input2.csv


Your SED line will render a semicolon delimited CSV file. I changed the semicolon
to a comma and tested a few lines of your sample file with the results below.

02,/08,/2013,01,:40,PM,1,357,490,WINDOW,~1.LOG,NT,AUTHORITY\SYSTEM,WindowsUpdate.log,
02,/08,/2013,08,:13,AM,497,NT,AUTHORITY\SYSTEM,SMSCFG.ini,
02,/08,/2013,08,:07,AM,58,182,NT,AUTHORITY\SYSTEM,setupact.log,
02,/08,/2013,08,:07,AM,67,584,NT,AUTHORITY\SYSTEM,bootstat.dat,
01,/28,/2013,05,:14,PM,50,400,BUILTIN\Administrators,PFRO.log,
01,/11,/2013,01,:02,PM,265,002,MSXML4,~4.LOG,BUILTIN\Administrators,msxml4,-KB2758694,-enu.LOG,
01,/07,/2013,08,:00,AM,267,292,MSXML4,~3.LOG,BUILTIN\Administrators,msxml4,-KB2721691,-enu.LOG,
01,/03,/2013,11,:03,PM,289,566,MSXML4,~2.LOG,NT,AUTHORITY\SYSTEM,msxml4,-KB973688,-enu.LOG,


The above worked out well for me when view with Excel.

Best wishes!

Re: Reading Columns & Output

Posted: 12 Feb 2013 15:34
by booga73
Thank you all for the help / assistance / illustrations provided by all of you folks, abc0502, foxidrive, Ocalabob, and suresh_knv.

I was trying to complete this script with the following edited in the script:

FOR /F "eol=; tokens=1-8* delims=," %%b IN (c:\temp1\WinDir1.txt) DO (
IF !linecount! EQU %maxlines% GOTO ExitLoop
Echo ^<table^> ^<tr^> ^<td^> %%b ^</td^> ^<td^> %%c ^</td^> ^<td^> %%d ^</td^> ^<td^> %%e ^</td^> ^<td^> %%f ^</td^> ^<td^> %%g ^</td^> ^<td^> %%h ^</td^> ^<td^> %%i ^</td^> ^</tr^> ^</table^> >> c:\temp1\myResults2.htm
SET /A linecount+=1
)

my final output would be base on each cell of data to reside in its own "position"; Due to the empty cells in each column / row, individual data is bleeding over to the neighboring empty cell position.

Ideally, I don't want to use HH, but instead use HTML.

that is the reasoning for using the carrot HTML to read each respective cell data wheather the data slot held a data value or data slot was empty.



I was thinking using sed; and wanted to know a good URL address where I can download it for windows environment.


I don't know if the native batch file code would keep intact the data positioning in the text file to be read and that using sed I could try and resolve the data to .csv thinking that when I do that, that either a cell that has data or not would be transfered into the .csv file and I can read back from the .csv file to post to an html table.

I like the batch script though too alot.

SED "s/^[ ]*//g" myResults2.txt |SED -e "s/\([0-9a-zA-Z\.]*\) */\1;/g">input2.csv

I would need to figure out if using SED for the text file to csv, then read data out of the .csv file to the needed html data cell.

Instead of reading each row of data, how about just simply reading the column of data?


What's the file size of SED? Where can I download a version for windows?

I'm going to give that a show and see if that will work, else, shave my head bald so that I don't have to pull out my hair out anymore. age with dignity !! lol

best regards, grateful for all your insight, Booga73

Re: Reading Columns & Output

Posted: 12 Feb 2013 16:53
by abc0502
Hi, booga73
Foxidrive code work with you right now, all what you have to do is modify the 2nd for command.
it's already processing the myresult2.txt you don't have to produce another file then process that file again.

> set the first part "!field:~0,75!" in a variable and read it as a text with a space as a delims in a for command and echo each token to a the html table form, then read the second part "!field:~75!" and do tha same and put that to your html code.

the for command will loop and do that to each line.
I'm trying to do that but can't get Foxidrive code to work with me, i will try again and i hope you get the idea.

EDITED
I managed to get it work but after moification, any way does it necessary to have the Short file name?
I can's get it out from the file.

Re: Reading Columns & Output

Posted: 12 Feb 2013 20:42
by foxidrive
This creates a CSV format file with text fields so the spaces are included. The only line that was changed is the one that echos the !field:~num,num!

It depends entirely on the source format so you may need to adjust the fields to suit what is in your file, with time format etc.


Code: Select all

:: ------------------------------------
:: beginning of batch file
@Echo off

md c:\temp1 2>nul
cd /d c:\temp1
cls

dir c:\windows\ /t:caw /r /x /q /a /o:-g-ds |find "/" > WinDir1.txt

:: code start to identify number of lines in a text
Set FileName=WinDir1.txt
Set /a LineNumb=0
for /f %%a in ('find /c /v "" ^< %FileName%') do set /a LineNumb=%%a
rem Echo %FileName% has %LineNumb% lines. > myResults.txt

:: code end to identify number of lines in a text

setlocal enabledelayedexpansion

SET /A maxlines=116
SET /A linecount=0

del myResults2.txt 2>nul

FOR /F "delims=" %%b IN (WinDir1.txt) DO (
IF !linecount! EQU %maxlines% GOTO ExitLoop
set "field=%%b"
>> myResults2.txt ECHO "!field:~0,10!","!field:~13,7!","!field:~21,17!","!field:~39,12!","!field:~52,23!","!field:~75!"
SET /A linecount+=1
)

:ExitLoop
del WinDir1.txt

:: sed 's/^[ ]*//g' myResults2.txt |sed -e 's/\([0-9a-zA-Z\.]*\) */\1;/g' > input2.csv
:: pause
start hh myResults2.txt
:: pause
:: del myResults2.txt

exit
:: end of batch file

:: ------------------------------------



This is what it generates here.

Code: Select all

"13/02/2013","1:30 PM","        1,846,131","WINDOW~1.LOG","NT AUTHORITY\SYSTEM    ","WindowsUpdate.log"
"10/02/2013","4:49 AM","           67,584","            ","NT AUTHORITY\SYSTEM    ","bootstat.dat"
"05/02/2013","1:48 AM","        1,604,476","            ","NT AUTHORITY\SYSTEM    ","setupact.log"
"03/02/2013","0:45 PM","            9,556","            ","BUILTIN\Administrators ","PFRO.log"
"29/01/2013","9:19 PM","           17,510","            ","BUILTIN\Administrators ","wincmd.ini"
"06/11/2012","3:20 PM","          788,480","            ","NT SERVICE\TrustedInsta","HelpPane.exe"
"03/11/2012","1:46 AM","           22,863","            ","...                    ","diagerr.xml"
"03/11/2012","1:46 AM","           22,863","            ","...                    ","diagwrn.xml"
"03/11/2012","1:46 AM","            6,633","            ","BUILTIN\Administrators ","comsetup.log"
"03/11/2012","1:44 AM","            3,960","DTCINS~1.LOG","NT AUTHORITY\SYSTEM    ","DtcInstall.log"
"03/11/2012","1:43 AM","                0","            ","BUILTIN\Administrators ","ativpsrm.bin"
"03/11/2012","1:13 AM","        1,367,641","WINDOW~2.LOG","BUILTIN\Administrators ","WindowsUpdate (1).log"
"03/11/2012","1:08 AM","            1,945","EPPLAU~1.MIF","BUILTIN\Administrators ","epplauncher.mif"
"01/11/2012","2:07 PM","            4,578","            ","BUILTIN\Administrators ","wcx_ftp.ini"
"11/10/2012","4:56 PM","        2,115,952","            ","NT SERVICE\TrustedInsta","explorer.exe"
"01/10/2012","9:57 AM","              453","            ","BUILTIN\Administrators ","INSTALL.LOG"
"31/08/2012","2:32 AM","               63","ALTAIR~1.INI","BUILTIN\Administrators ","Altair_1.250.INI"
"02/08/2012","4:27 AM","          917,748","            ","BUILTIN\Administrators ","ntbtlog.txt"
"26/07/2012","5:09 PM","            1,585","VMGCOI~1.LOG","NT AUTHORITY\SYSTEM    ","vmgcoinstall.log"
"26/07/2012","5:03 PM","                0","            ","NT AUTHORITY\SYSTEM    ","setuperr.log"
"26/07/2012","3:17 PM","              219","            ","NT AUTHORITY\SYSTEM    ","system.ini"
"26/07/2012","2:21 PM","            9,728","            ","NT SERVICE\TrustedInsta","write.exe"
"26/07/2012","2:21 PM","           10,752","            ","NT SERVICE\TrustedInsta","winhlp32.exe"
"26/07/2012","2:20 PM","           30,208","            ","NT SERVICE\TrustedInsta","twunk_32.exe"
"26/07/2012","2:20 PM","          109,056","            ","NT SERVICE\TrustedInsta","splwow64.exe"
"26/07/2012","2:20 PM","          133,120","            ","NT SERVICE\TrustedInsta","regedit.exe"
"26/07/2012","2:20 PM","          233,984","            ","NT SERVICE\TrustedInsta","notepad.exe"
"26/07/2012","2:20 PM","           15,872","            ","NT SERVICE\TrustedInsta","hh.exe"
"26/07/2012","2:20 PM","           68,608","            ","NT SERVICE\TrustedInsta","bfsvc.exe"
"26/07/2012","2:20 PM","           50,176","            ","NT SERVICE\TrustedInsta","twain_32.dll"
"26/07/2012","7:41 AM","           43,131","            ","NT SERVICE\TrustedInsta","mib.bin"
"26/07/2012","7:18 AM","           15,901","PROFES~2.XML","BUILTIN\Administrators ","ProfessionalWMC.xml"
"26/07/2012","7:18 AM","           15,769","            ","NT AUTHORITY\SYSTEM    ","Starter.xml"
"26/07/2012","7:18 AM","           15,941","PROFES~1.XML","BUILTIN\Administrators ","Professional.xml"
"20/07/2012","2:02 AM","              152","            ","BUILTIN\Administrators ","pkplugin.ini"
"15/07/2012","1:27 PM","        2,216,480","            ","BUILTIN\Administrators ","wweb32.dll"
"18/06/2012","1:35 AM","        2,456,576","{DE779~1    ","BUILTIN\Administrators ","{DE779690-B876-11E1-8273-00241D23F809}"
"17/06/2012","0:27 PM","        1,851,904","{C3621~1    ","BUILTIN\Administrators ","{C3621EC7-B86B-11E1-80AB-00241D23F809}"
"03/06/2012","1:46 AM","              707","            ","NT SERVICE\TrustedInsta","_default.pif"
"03/06/2012","1:46 AM","          256,192","            ","NT SERVICE\TrustedInsta","winhelp.exe"
"03/06/2012","1:37 AM","           49,680","            ","NT SERVICE\TrustedInsta","twunk_16.exe"
"03/06/2012","1:37 AM","           94,784","            ","NT SERVICE\TrustedInsta","twain.dll"
"03/06/2012","1:34 AM","          316,640","            ","NT SERVICE\TrustedInsta","WMSysPr9.prx"
"03/06/2012","1:32 AM","              670","            ","NT SERVICE\TrustedInsta","WindowsShell.Manifest"
"17/05/2012","4:24 PM","              793","            ","...                    ","XXCLONE.INI"
"12/05/2012","6:53 PM","              303","            ","BUILTIN\Administrators ","SynInst.log"
"12/05/2012","6:21 PM","            1,355","TSSYSP~1.LOG","NT AUTHORITY\SYSTEM    ","TSSysprep.log"
"09/03/2012","8:57 AM","              545","            ","BUILTIN\Administrators ","PKUNZIP.PIF"
"09/03/2012","8:57 AM","              545","            ","BUILTIN\Administrators ","PKZIP.PIF"
"09/03/2012","8:57 AM","              545","            ","BUILTIN\Administrators ","NOCLOSE.PIF"
"09/03/2012","8:57 AM","              545","            ","BUILTIN\Administrators ","RAR.PIF"
"09/03/2012","8:57 AM","              545","            ","BUILTIN\Administrators ","ARJ.PIF"
"09/03/2012","8:57 AM","              545","            ","BUILTIN\Administrators ","LHA.PIF"
"09/03/2012","8:57 AM","              545","            ","BUILTIN\Administrators ","UC.PIF"
"18/06/2011","6:03 AM","               66","            ","BUILTIN\Administrators ","W7T.txt"
"14/07/2009","3:54 PM","              403","            ","NT AUTHORITY\SYSTEM    ","win.ini"
"14/07/2009","2:14 PM","            9,728","            ","NT SERVICE\TrustedInsta","winhlp32.exe.org"
"11/06/2009","8:19 AM","            1,405","            ","NT AUTHORITY\SYSTEM    ","msdfmap.ini"
"13/02/2013","1:28 PM","   <DIR>         ","            ","...                    ","Prefetch"
"13/02/2013","3:35 AM","   <DIR>         ","            ","...                    ","Temp"
"13/02/2013","3:33 AM","   <DIR>         ","MICROS~1.NET","NT SERVICE\TrustedInsta","Microsoft.NET"
"08/02/2013","2:46 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","CbsTemp"
"08/02/2013","2:46 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","WinSxS"
"08/02/2013","2:46 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","System32"
"07/02/2013","1:39 AM","   <DIR>         ","INSTAL~1    ","BUILTIN\Administrators ","Installer"
"05/02/2013","0:57 PM","   <DIR>         ","AUINST~1    ","...                    ","AUInstallAgent"
"05/02/2013","9:07 AM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","inf"
"28/01/2013","6:38 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","twain_32"
"28/01/2013","6:38 PM","   <DIR>         ","            ","BUILTIN\Administrators ","medias"
"28/01/2013","6:38 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","."
"28/01/2013","6:38 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta",".."
"27/01/2013","3:00 AM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","assembly"
"21/01/2013","6:26 AM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","Fonts"
"13/01/2013","8:21 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","rescache"
"13/01/2013","6:20 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","WinStore"
"13/01/2013","6:20 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","ehome"
"28/12/2012","1:38 PM","   <DIR>         ","TOASTD~1    ","NT SERVICE\TrustedInsta","ToastData"
"18/12/2012","1:16 AM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","Logs"
"13/12/2012","2:58 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","debug"
"02/12/2012","3:26 AM","   <DIR>         ","            ","...                    ","Minidump"
"01/12/2012","6:48 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","Tasks"
"01/12/2012","6:48 PM","   <DIR>         ","REGIST~2    ","BUILTIN\Administrators ","registration"
"01/12/2012","8:22 AM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","apppatch"
"22/11/2012","2:37 AM","   <DIR>         ","POLICY~1    ","NT SERVICE\TrustedInsta","PolicyDefinitions"
"03/11/2012","4:30 AM","   <DIR>         ","IMMERS~1    ","NT SERVICE\TrustedInsta","ImmersiveControlPanel"
"03/11/2012","4:28 AM","   <DIR>         ","SOFTWA~1    ","BUILTIN\Administrators ","SoftwareDistribution"
"03/11/2012","1:50 AM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","Panther"
"03/11/2012","1:46 AM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","Media"
"03/11/2012","1:45 AM","   <DIR>         ","DOWNLO~1    ","NT SERVICE\TrustedInsta","Downloaded Program Files"
"03/11/2012","1:44 AM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","schemas"
"03/11/2012","1:43 AM","   <DIR>         ","LIVEKE~1    ","...                    ","LiveKernelReports"
"12/08/2012","9:38 AM","   <DIR>         ","            ","BUILTIN\Administrators ","Sun"
"26/07/2012","7:27 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","ShellNew"
"26/07/2012","7:27 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","SKB"
"26/07/2012","7:27 PM","   <DIR>         ","BITLOC~1    ","NT SERVICE\TrustedInsta","BitLockerDiscoveryVolumeContents"
"26/07/2012","7:27 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","security"
"26/07/2012","7:23 PM","   <DIR>         ","DIGITA~1    ","NT AUTHORITY\SYSTEM    ","DigitalLocker"
"26/07/2012","7:23 PM","   <DIR>         ","SERVIC~1    ","NT SERVICE\TrustedInsta","servicing"
"26/07/2012","7:23 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","en-GB"
"26/07/2012","7:23 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","IME"
"26/07/2012","7:23 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","en-US"
"26/07/2012","7:23 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","Help"
"26/07/2012","5:53 PM","   <DIR>         ","L2SCHE~1    ","NT SERVICE\TrustedInsta","L2Schemas"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","addins"
"26/07/2012","5:53 PM","   <DIR>         ","DESKTO~1    ","NT SERVICE\TrustedInsta","DesktopTileResources"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","System"
"26/07/2012","5:53 PM","   <DIR>         ","OFFLIN~1    ","NT SERVICE\TrustedInsta","Offline Web Pages"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","Cursors"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","SchCache"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","Branding"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","Boot"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","TAPI"
"26/07/2012","5:53 PM","   <DIR>         ","MODEML~1    ","...                    ","ModemLogs"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT AUTHORITY\SYSTEM    ","ELAMBKUP"
"26/07/2012","5:53 PM","   <DIR>         ","RESOUR~1    ","NT SERVICE\TrustedInsta","Resources"
"26/07/2012","5:53 PM","   <DIR>         ","            ","NT SERVICE\TrustedInsta","Web"

Re: Reading Columns & Output

Posted: 12 Feb 2013 21:29
by Ocalabob
Greetings Booga73,
I'll be brief as questions about SED and SED usage are pushing the
intent of this forum.
1. Get SED here http://gnuwin32.sourceforge.net/packages/sed.htm
Download the Set up Program.
2. SED.exe is 76Kb. It has 3 dependency files that total about
1.1Mb
3. Given your example, a comma delimited file that would put each
character in a single column could be generated with:

Code: Select all

SED -e "s/\([0-9a-zA-Z\.//_<>:~-]\) */\1,/g" myresults2.txt>input2.csv


Sample output looks like:

Code: Select all

0,2,/,0,8,
,2,0,1,3,0,1,:,4,0,P,M,1,3,5,7,4,9,0,W,I,N,D,O,W,~,1,.,L,O,G,N,T,A,U,T,H,O,R,I,T,Y,\,S,Y,S,T,E,M,W,i,n,d,o,w,s,U,p,d,a,t,e,.,l,o,g,
0,2,/,0,8,/,2,0,1,3,0,8,:,1,3,A,M,4,9,7,N,T,A,U,T,H,O,R,I,T,Y,\,S,Y,S,T,E,M,S,M,S,C,F,G,.,i,n,i,
0,2,/,0,8,/,2,0,1,3,0,8,:,0,7,A,M,5,8,1,8,2,N,T,A,U,T,H,O,R,I,T,Y,\,S,Y,S,T,E,M,s,e,t,u,p,a,c,t,.,l,o,g,
0,2,/,0,8,/,2,0,1,3,0,8,:,0,7,A,M,6,7,5,8,4,N,T,A,U,T,H,O,R,I,T,Y,\,S,Y,S,T,E,M,b,o,o,t,s,t,a,t,.,d,a,t,
0,1,/,2,8,/,2,0,1,3,0,5,:,1,4,P,M,5,0,4,0,0,B,U,I,L,T,I,N,\,A,d,m,i,n,i,s,t,r,a,t,o,r,s,P,F,R,O,.,l,o,g,


I've SED enough on this thread. Best wishes in dealing with your project Booga73!