Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
extract lines from file and copy to another file
#1
hello,

i have a large file eg original.txt, i want to search for a specific argument, if found the whole line has to be copied to another file eg.. found.txt. can this be managed?

tia

freggel
#2
Try this i think it is what you need not sure
Function Function13
Code:
Copy      Help
str sFile="$desktop$\original.txt" ;;File name
str ArgumentToFind="Example";; Word looking for
str WildCard="*"
ArgumentToFind-WildCard;ArgumentToFind+WildCard
str s ss
ss.getfile(sFile)
foreach s ss
,if matchw(s ArgumentToFind 3)
,,out s
#3
or this i think is more what you want
Function Function13
Code:
Copy      Help
str sFile="$desktop$\original.txt" ;;File name
str ArgumentToFind="rn";; Word looking for
str destFolder="$desktop$\Found";;
str WildCard="*"
ArgumentToFind-WildCard;ArgumentToFind+WildCard
mkdir destFolder
destFolder+"\Found-%i.txt"
int j i
str s ss s3
ss.getfile(sFile)
foreach s ss
,i+1
,if matchw(s ArgumentToFind 3)
,,j+1
,,s3.format(destFolder j)
,,s.setfile(s3)
,,out s


Forum Jump:


Users browsing this thread: 1 Guest(s)