This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Find

Find
finds the first line in an input stream that contains the specified string.
Find
finds the first line that contains any of the specified strings.
  • Find breaks the input stream into records, delimited by record separators, and scans each record for the strings you specify.
  • Find returns as a string the first record which contains the specified text.
  • If Find does not find any record which contains the specified text before it reaches the end of the file, it returns EndOfFile.
  • The following options can be given:
AnchoredSearchFalsewhether to require that the text searched for be at the beginning of a record
IgnoreCaseFalsewhether to treat lowercase and uppercase letters as equivalent
RecordSeparators{"\r\n", "\n","\r"}separators for records
WordSearchFalsewhether to require that the text searched for appear as a word
WordSeparators{" ","\t"}separators for words
  • The first argument to Find can be InputStream, or simply if there is only one open input stream with the specified name.
  • Find does not close streams after it finishes reading from them.
Open a stream:
Get the first line that contains :
Find the next line that contains :
Open a stream:
Find the first line that contains or :
Open a stream:
In[1]:=
Click for copyable input
Out[1]=
Get the first line that contains :
In[2]:=
Click for copyable input
Out[2]=
Find the next line that contains :
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
 
Open a stream:
In[1]:=
Click for copyable input
Out[1]=
Find the first line that contains or :
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
New in 2