#32380 - 2002-11-13 05:28 PM
extract line in file
|
brotons
Fresh Scripter
Registered: 2002-08-23
Posts: 7
Loc: valbonne
|
I have file c:\toto.txt I have will want to extract a line from this file. The line starts with the word "disk". And I will want to have the line in a variable $poul thank 's
|
|
Top
|
|
|
|
#32382 - 2002-11-14 05:52 PM
Re: extract line in file
|
brotons
Fresh Scripter
Registered: 2002-08-23
Posts: 7
Loc: valbonne
|
it's ok but I have a problem with dfsnbt.exe it does not give me information if I am not an administrator of the machine :=(
|
|
Top
|
|
|
|
#32390 - 2002-11-14 10:55 PM
Re: extract line in file
|
pc_g0d
Fresh Scripter
Registered: 2001-11-06
Posts: 7
|
I personally would change Waltz's code so that it only looked at the first four characters like so:
code:
;test.kix; $handle = FreeFileHandle() $infile = "c:\toto.txt" IF $handle > 0 IF Open($handle,$infile) = 0 $fileline = ReadLine($handle) WHILE @error = 0 $chk = LEFT($fileline,4) IF $chk = "disk" $poul=$fileline ?$poul ENDIF $fileline = ReadLine($handle) LOOP Else "File open error "+@error+" "+@serror? EndIf Else "File handle error "+@error+" "+@serror? EndIf IF Close($handle) <> 0 "File close error "+@error+" "+@serror? EndIf
_________________________
Move out of my way or I'll replace you with a kix script.
|
|
Top
|
|
|
|
#32394 - 2002-11-14 11:15 PM
Re: extract line in file
|
pc_g0d
Fresh Scripter
Registered: 2001-11-06
Posts: 7
|
Jens,
1.Sometimes you only want a line that begins with a specific set of characters. 2.Other times you just want to find the set of characters somewhere in the line. My code shows 1. Waltz shows 2.
_________________________
Move out of my way or I'll replace you with a kix script.
|
|
Top
|
|
|
|
#32399 - 2002-11-15 12:17 AM
Re: extract line in file
|
kholm
Korg Regular
   
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
Be nice to new users
This is the starters forum !!!
Also remember that this post might pop up from a search on the internet.
If this were my first experience with KiXtart.org, I would assume that it was a chat room for golf
I know I'm breaking the rules: Hijacking a post and posting in a wrong forum, BUT I was not the first
-Erik
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 837 anonymous users online.
|
|
|