1.

Solve : Need a bit of help?

Answer»

Hi all,

I have a question. I want information from a text file written to another file.

Below is an example of a line in the text file

jan-21,16:25:35.265 CSTASRV Agent_Selected callid 363548 devicenr1 0302304493 devicenr2 3353 agentname1 agentname2 clinden acdname KSC 1e lijn MMCType Voice Skill

This is the info i want out of it and written into a new txt file
jan-21,16:25:35.265 devicenr1 0302304493 agentname2 clinden acdname KSC 1e lijn

I am a bit stuck on how to do this..can anyone HELP me out?
thanks a lot,
TheoCode: [Select]for /F "tokens=19 delims= " %%a in (file.txt) do (
echo.%%a %%f %%G %%k %%l %%m %%n %%o %%P
)
try thatyou'd need to have ('type file.txt') or usebackq (`file.txt`).

FBThis what i have so far:

@echo off
color 31
cd c:\mitroslog
SET /P filename=Enter the name of the file...
SET /P search1=Enter first search command...
SET /P search2=Enter second search command...
findstr %search1% %filename% > eerstefiltering.txt
findstr %search2% eerstefiltering.txt > gevraagdeinformatie.txt
del C:\mitroslog\eerstefiltering.txt
START /MAX NOTEPAD.EXE "C:\mitroslog\gevraagdeinformatie.txt"
exit

I am new to this so not sure were to put the EXTRA scripting to GET the desired information.
jan-21,16:25:35.265 CSTASRV Agent_Selected callid 363548 devicenr1 0302304493 devicenr2 3353 agentname1 agentname2 clinden acdname KSC 1e lijn MMCType Voice Skill ---> this is put into gevraagdeinformatie.txt

jan-21,16:25:35.265 devicenr1 0302304493 agentname2 clinden acdname KSC 1e lijn ---> This is what i want to filter out of gevraagdeinformatie.txt..and if possible put in another txt file.

Thanks a lot for the help


Code: [Select]for /F "tokens=1-19 delims= " %%a in ('type gevraagdeinformatie.txt') do (
echo.%%a %%f %%g %%k %%l %%m %%n %%o %%p >> temp.txt
)



Discussion

No Comment Found