Documentation

grep

Syntax: %grep(filenum,pattern)

search the filenum file and return lines that match the <i>pattern</i>.

Example:

#FILE 1 "num_test.txt"
#99 {#WRITE 1 %i}
#CLOSE 1
this just creates a test file containing the numbers 1 to 99 (each on a line)

now:

#FILE 1 "num_test.txt"
#SHOW %grep(1,"[35]$")
#CLOSE 1
displays a list of all lines ending in either a 3 or 5; i.e. it outputs:
Opened num_test.txt as file 1
3|5|13|15|23|25|33|35|43|45|53|55|63|65|73|75|83|85|93|95
Closed num_test.txt on file 1

Add comment

Login or register to post comments