|
Answer» i have a source file with many entry of the follow data ==============================================* * * * * * * * * * * User information . . . . . : : User name . . . . . . . . . : ABAX * * User text . . . . . . . . . : Beatrice Raffaele * Begin menu . . . . . . . . : *NONE Group jobs . . . . . . . . : 15 END group jobs . . . . . . : *NO Command line on menus . . . : *NO Attention-key program . . . : *ACTIVE Reference user . . . . . . : OPERATOR ==================================================================================================================================== XXXXXXXX | XXXXXXXXX | --- other information not relevant XXXXXXXXXX | ===================================================================================================================================== * * * * * * * * * * * User information . . . . . : : User name . . . . . . . . . : ABCG * * User text . . . . . . . . . : BarchiesiGiancarlo Begin menu . . . . . . . . : *NONE Group jobs . . . . . . . . : 15 End group jobs . . . . . . : *NO Command line on menus . . . : *NO Attention-key program . . . : *ACTIVE Reference user . . . . . . : OPERATOR ====================================================================================================================================
XXXXXXXX | XXXXXXXXX | --- other information not relevant XXXXXXXXXX |
===================================================================================================================================== * * * * * * * * * * * User information . . . . . : : User name . . . . . . . . . : ABEF * * User text . . . . . . . . . : Fabio Besomi* Begin menu . . . . . . . . : *NONE Group jobs . . . . . . . . : 15 End group jobs . . . . . . : *NO Command line on menus . . . : *NO Attention-key program . . . : *ACTIVE ference user . . . . . . : OPERATOR ====================================================================================================================================
I need to extract the data out and put into the a csv format.
the end result should be like following:
User name ,User text, Begin menu, Group jobs ,End group jobs,Command line on menus ,Attention-key ....
ABAX ,Beatrice Raffaele, *NONE, 15,NO,NO,ACTIVE.... ABCG, Barchiesi Giancarlo, *NONE,...............
so basically this is the intention..
@echo off>%temp%\input.txt cls setlocal enabledelayedexpansion
for /f "tokens=*" %%1 in (input.txt) do ( set inline=%%1& set inline=!inline:.=! if not "!inline:~0,3!" equ "* *" ( if not "!inline:~0,3!" equ "===" ( echo !inline!>>%temp%\input.txt ) ) )
i got into this and kinda of stuck...
thanks for helping!!In case anyone gets motivated to help this user with this problem he has been HEAVILY helped over on the DosTips.com forums and really didn't provide all the upfront information INITIALLY. So if you do feel like helping them, then read this thread first. http://www.dostips.com/forum/viewtopic.php?f=3&t=3367Quote from: Squashman on May 30, 2012, 05:54:36 AM In case anyone gets motivated to help this user with this problem he has been heavily helped over on the DosTips.com forums and really didn't provide all the upfront information initially. So if you do feel like helping them, then read this thread first. http://www.dostips.com/forum/viewtopic.php?f=3&t=3367
In the quoted link Aacini POSTED on 6 Dec 2011 QuoteI suggest you to pay more attention in future topics: post the real data and precise output samples, please! Yesterday in Computing.net Wahine, who is normally cool calm and collected, posted QuoteThe first thing you must learn is that when you post a request for assistance you must ensure that the information you give is accurate and complete. It APPEARS that you now want to change the content of the input file you originally posted. This means that my efforts have been wasted and I can assure you that I am less than pleased by that.
I will wait 24 hours for you to review the information you have provided and come back to confirm or alter it. Please remember the information must be accurate and complete. It seems that cheeseng will not supply necessary details and I can see that Wahine will do a runner soon.
|