$ ! Uncommenter $ ! $ ! (C) 2005-2006 Dr. ERDI Gergo $ ! $ ! See http://cactus.rulez.org/elte/2005-1-vms/#4 for a description of what it does $ ! $ ! Licensed under the GNU General Public License, version 2 $ $ IF (P2 .EQS. "") $ THEN $ WRITE SYS$ERROR "ERROR: Missing argument" $ EXIT $ ENDIF $ $ OPEN /READ inf 'P1' $ OPEN /WRITE outf 'P1' $ $ LOOP_B: $ READ /END_OF_FILE=LOOP_E inf line $ CALL substr "''line'" "''P2'" $ WRITE outf F$EXTRACT(0, r, line) $ GOTO LOOP_B $ LOOP_E: $ $ CLOSE inf $ CLOSE outf $ EXIT $ $ ! substr str pat: returns in 'r' the first occurance of 'pat' in 'str' $ substr: SUBROUTINE $ IF (F$LEN(P2) .GT. F$LEN(P1)) $ THEN $ r == F$LEN(P1) $ EXIT $ ENDIF $ $ i = 0 $ LOOP_B: $ IF (i .EQ. F$LEN(P1)) THEN GOTO LOOP_E $ IF (F$EXTRACT(i, F$LEN(P2), P1) .EQS. P2) THEN GOTO LOOP_E $ i = i + 1 $ GOTO LOOP_B $ LOOP_E: $ r == i $ ENDSUBROUTINE