grep

From DavinciWiki
(Difference between revisions)
Jump to: navigation, search
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DavinciWiki_Function}}
+
{{DavinciWiki_Function|
[[category:C_Programs]]
+
Search for the first occurrence of a pattern
 +
|
 +
Arguments: A text buffer and a string
 +
 +
Return Value: The lines of text containing the string
 +
|
 +
[[Syntax]]: grep(object = TEXT, pattern = STRING)
 +
 +
The grep() function copies each row of the passed TEXT object that contains the specified pattern.  grep() supports regex patterns.
 +
|
 +
dv> text
 +
Text Buffer with 3 lines of text
 +
    1: This is a text buffer containing
 +
    2: some information that you want
 +
    3: we will use grep() to find it
 +
 +
dv> aline = grep(text,"information")
 +
Text Buffer with 1 lines of text
 +
    1: some information that you want
 +
|
 +
|
 +
|
 +
*[[strstr]]
 +
*[[strsub]]
 +
|
 +
|
 +
}}
 
[[category:Functions]]
 
[[category:Functions]]
 +
[[category:Davinci Core]]
 
[[category:String Functions]]
 
[[category:String Functions]]

Latest revision as of 10:44, 27 March 2006



Description

Search for the first occurrence of a pattern

Arguments and Return Values

Arguments: A text buffer and a string

Return Value: The lines of text containing the string

Usage

Syntax: grep(object = TEXT, pattern = STRING)

The grep() function copies each row of the passed TEXT object that contains the specified pattern. grep() supports regex patterns.

Examples

dv> text
Text Buffer with 3 lines of text
    1: This is a text buffer containing
    2: some information that you want
    3: we will use grep() to find it

dv> aline = grep(text,"information")
Text Buffer with 1 lines of text
    1: some information that you want

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 03-27-2006

Personal tools