extracting specific paragrfs from text file

Discuss RoboTask here
Post Reply
mahirfarook
Posts: 1
Joined: Fri Jan 23, 2015 6:41 pm

extracting specific paragrfs from text file

Post by mahirfarook »

how to extract specific paragraphs from a text file and save it to another new text file...?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: extracting specific paragrfs from text file

Post by Oleg »

mahirfarook wrote:how to extract specific paragraphs from a text file and save it to another new text file...?
What criteria? Algorithm may be VERY complex.

See the simple example below. This task processes TXT files in folder D:\incoming
It extracts 1-st line from the text and save it in new file in D:\Dest folder.

Save the task into a file and use menu Task->Import to import it into RoboTask. Next you can see it in task editor of RoboTask.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1242"
Hide=INTEGER|0
ID=INTEGER|597248694
LogOnAsUser=INTEGER|1
Name=STRING|"extract 1-st line from text"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""CNT"" with value ""1"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CNT"
varvalue=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"20150124"
date2=STRING|"20150124"
destvar=STRING|"FILENAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"D:\incoming\*.txt"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_TXT_EXTRACTLINE"
Enabled=INTEGER|-1
Name=STRING|"TXT Extract Line"
Params=FOLDER

[Actions\Action3\Params]
external=STRING|"1"
filename=STRING|"{filename}"
linecount=STRING|"0"
linenum=STRING|"1"
variable=STRING|"line"

[Actions\Action4]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file d:\dest\{cnt}.txt"
Params=FOLDER

[Actions\Action4\Params]
encode=STRING|"0"
fileexists=STRING|"0"
filname=STRING|"d:\dest\{cnt}.txt"
line0=STRING|"{line}"
linecount=STRING|"1"
suppress=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""cnt"""
Params=FOLDER

[Actions\Action5\Params]
incement=STRING|"1"
vaiable=STRING|"cnt"

[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov
Post Reply