TIP: Click on subject to list as thread! ANSI
echo: 4dos
to: Dale Shipp
from: mark lewis
date: 2005-01-11 09:11:10
subject: Search

i'm responding based on 4DOS and 4OS2 knowledge with the assumtion that 4NT
is the same as they are...

 DS>   Is there a command in 4NT that will search a
 DS> file for a particular string and then allow the
 DS> string following that to be read?

no, not one command... you'd have to work something together...

 DS>   I have seen commands that allow looking for
 DS> a file that contains a string,

right...

 DS> but can't see that it does anything other than
 DS> returning the file name.

right...

 DS>   Explicitly I want to search a file for the string
 DS>   Attachment COnverted:
 DS>   and then take the string following that to use as
 DS> a file name parameter into another command.

 DS>   I could write a C program to do this, but using
 DS> 4NT would be easier.

in either one, you'll have to develop the loop to read the file looking for
your line and the logic to figure out whether to continue looking or drop
out of the loop once you've located your target... unless those two lines
are in the same place each time which would make things a lot easier...

anyway, something like this might help...


  set srchfile = blah.txt
  set srchstr = Attachment Converted:
  set nextcmd = dir
  set curlinenum = 0
  set curline =
  set success = no
  :loop
  set curline = %{at}line[%srchfile,%curlinenum]
  iff %{at}index[%{at}upper[%curline],%{at}upper[%srchstr]] GE 0 then
    set success=yes
  endiff
  set curlinenum = %{at}inc[%curlinenum]
  iff %success EQ no then
    goto loop
  else
    set curline = %{at}line[%srchfile,%curlinenum]
  endiff
  %nextcmd %curline


written on the fly and not tested...

)\/(ark

* Origin: (1:3634/12)
SEEN-BY: 633/267 270
@PATH: 3634/12 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.