Page 1 of 1 1
Topic Options
#44782 - 2003-09-04 04:15 PM Find string in a file
rojcasca Offline
Lurker

Registered: 2003-09-04
Posts: 3
Hi,

I'm new with Kix, this is my question:

I'need found a string in a specific file, i don't find any command.

Please Help me.

Thank You

Top
#44783 - 2003-09-04 04:21 PM Re: Find string in a file
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
be more specific.

do you need to replace a string?
do you need only to find if it is present?
do you need to return the string?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#44784 - 2003-09-04 04:24 PM Re: Find string in a file
rojcasca Offline
Lurker

Registered: 2003-09-04
Posts: 3
Sorry,

I need find If the string is present in a file

Top
#44785 - 2003-09-04 04:37 PM Re: Find string in a file
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
see this link

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=007764
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#44786 - 2003-09-05 11:48 AM Re: Find string in a file
rojcasca Offline
Lurker

Registered: 2003-09-04
Posts: 3
Hi Radimus,

I don't understand the URL what it's the command to find string in a file?.

Top
#44787 - 2003-09-06 12:29 AM Re: Find string in a file
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
you can't find it in a file, you have to read the file and then do an instr() on each line
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#44788 - 2003-09-05 01:00 PM Re: Find string in a file
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Alternatively, if you just want to check if the string is in the file, used the DOS "FIND" command.

For example:
code:
FIND /I "string" myfile.txt

Will search myfile.txt for "string".

The exit code will be "0" if the string is present, and "1" if it is not.

In KiXtart you can "Shell" the command and check @ERROR or %ERRORLEVEL%

Top
#44789 - 2003-09-17 11:40 PM Re: Find string in a file
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
See also the following UDF: IsStringInFile() - Checks whether a string is present in a file
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.173 seconds in which 0.13 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