i need to extract some content from following information (source file)
* *
* * * * * * * * * 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
=====================================================================================================================================
* * * * * * * * * User information . . . . . : User name . . . . . . . . . : ABCG * * * * * * * * *
* User text . . . . . . . . . : Barchiesi Giancarlo *
Begin menu . . . . . . . . : *NONE
Group jobs . . . . . . . . : 15
End group jobs . . . . . . : *NO
Command line on menus . . . : *NO
Attention-key program . . . : *ACTIVE
Reference user . . . . . . : OPERATOR
=====================================================================================================================================
and the list go on,,,
my desire output is
user name , User text , Begin menu , Group jobs , End group jobs , Command line on menus , ….
Beatrice .. , *NONE ,
Barchiesi ,
basically will have a column header and follow by the entries…
i read somewhere
for /f “tokens=*” %%a in (‘find /i “User name” ^<..\abc.txt’) do (
set %%a
(echo User name: !user name!
echo user text: !user text!
echo Begin menu : !Begin menu!
echo Group jobs : !Group jobs!
echo End group jobs : !End group jobs!
echo Command line on menus : !command line on menus!
echo Attention-key program : !Attention-key program!
echo Reference user : !Reference user!
)>>output.txt
)
but this doesn’t work on my case.. would appreciate someone reply …thanks!!!
EDIT:
Sorry for the typo
in fact the ouput shall be..
User name User text Begin menu ……
ABAX Beatrice Raffaele *NONE
ABCG Barchiesi Giancarlo *NONE
something like this… and continue to the rest of the row
🙂 thanks.. would appreciate for the help..
@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 ) ) ) @echo off>%temp%\input2.txt for /f "tokens=*" %%1 in (%temp%\input.txt%) do ( set input=%%1 for /f "tokens=2 delims=:" %%A in ("!input!") do ( set ending=%%A if "!ending:~1,1!" equ "*" ( echo !ending:~2!>>%temp%\input2.txt ) else ( echo !ending!>>%temp%\input2.txt ) ) ) @echo off>%temp%\input.txt for /f "tokens=1* delims=*" %%1 in (%temp%\input2.txt) do ( set final=%%1 if "!final:~0,1!" equ " " ( set final=!final:~1! ) echo !final!>>%temp%\input.txt ) echo User name,User text,Begin menu,Group jobs,End group jobs,Command ^ line on menus,Attention-key program,Reference user>newfile.csv for /f "tokens=*" %%1 in (%temp%\input.txt) do ( set line=!line!%%1, set /a ctr +=1 If !ctr! equ 8 ( set line=!line:~0,-1! echo !line!>>newfile.csv set ctr= set line= ) ) :cleanup del %temp%\input*.txtPlease come back & tell us if your problem is resolved.