Page 1 of 1 1
Topic Options
#61906 - 2002-01-07 01:30 AM Search with findstr
Grutte Pier Offline
Getting the hang of it

Registered: 2001-10-06
Posts: 52
Loc: Leeuwarden, The Netherlands
Hello,

I am looking for a simple way to find a complete sentence where a name is found in.
And load this sentence to a variable.

I've tried to write a sentence from "all.txt" to the variable "$result" where "franse" is true :

$result = SHELL '%comspec% /c findstr /I /C:"franse" A:\all.key'

But it does not work.

Sugestions?

Thanks,

Frans

Top
#61907 - 2002-01-07 02:23 AM Re: Search with findstr
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
What if there's more than one occurrence of the name (in the file) ... this will produce multiple occurences ... would you want just the last occurence ? or the first ? or an array of occurences ? Or maybe you know before hand that there will ALWAYS be only one occurence ?

-Shawn

p.s.

Might want to give the Pipe UDF a quick try, it submits a command to the shell and automatically redirects the output to an internal kixtart array. Here's an example:

Script Code:




$occurences = pipe('find /i "franse" c:\test.dat')


if ubound($occurences)
for $i=1 to ubound($occurences)
?"found=" $occurences[$i]
next
endif


Here's a link to Pipe()

-Shawn

[ 08 January 2002: Message edited by: Shawn ]

Top
#61908 - 2002-01-08 06:11 PM Re: Search with findstr
mvdw Offline
Starting to like KiXtart

Registered: 2001-05-01
Posts: 124
Loc: Voorburg, Netherlands
Frans,

You might also want to try to open the text file in kix and then use the ReadLineEx function to find the line, read it, manipulate it, etc etc.

brings me to a new idea, udf (WriteLineEx ..???) to write a line to a file on a specific line number (somebody probably made that already ... ??? )

_________________________
rgrds, Maarten

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 484 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.047 seconds in which 0.021 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org