Solved Using batch to extrat data from txt file

March 3, 2011 at 23:54:42
Specs: Windows xp
Hi I am new to the forum and this is a bit tricky to ask so bare with me please.

I currently run a script on a server wich tells me how many profiles are on peoples mahines which are over 30 mb.If they smaller then that they get deleted.

The script generates text files for every machine which meets this criteria.

I need to now as there is around a 1000 text files to be able to extract or output an exact number of profiles which are more or equal to 30 mb but less then or equal to 50mb

the text file generates a series of lines such as PCID1234 follwed by user name and size of profile

hope this makes sense


the files get outputted like this PCID3028: C:\Documents and Settings\USERNAME(35MB)

may have mutiple lines though in one file


See More: Using batch to extrat data from txt file

Report •


#1
March 4, 2011 at 00:23:11
Not much can be done without seeing the file.


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
March 4, 2011 at 02:42:54
the files get outputted like this PCID3028: C:\Documents and Settings\USERNAME(35MB)

may have mutiple lines though in one file


Report •

#3
March 4, 2011 at 04:28:09
✔ Best Answer
:: ==========================================
::
:: kelly.bat Fri 04-03-2011 19:11:09.28
@echo off & setLocal enableDELAYedeXpansion

for /f "tokens=1* delims= " %%a in (data.txt) do (
set S=%%b
set S=!S:~-5!
set S=!S:~0,-3!
if !S! geq 30 if !S! leq 50 echo %%a between 30 and 50
)


=====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions

#4
March 4, 2011 at 05:01:53
Dumb question but how does this work as i currently get the files created in a folder called Profile Logs which is on a network share and within the folder is around about 1000 different named text files with the content as mentioned before

Report •

#5
March 4, 2011 at 05:47:38
That's your homework assignment.

hint: Nest my script within a FOR loop to process all files in the folder.


=====================================
Life is too important to be taken seriously.

M2


Report •

#6
March 4, 2011 at 07:05:09
Thanks but it not something I going to be able to find as I dont programme normaly

Report •


Ask Question