We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3024236 commit 40e404cCopy full SHA for 40e404c
1 file changed
os/programs/search.rrbasic
@@ -0,0 +1,33 @@
1
+IF ARGS$ = "" THEN
2
+ PRINT "File name not specified"
3
+ END
4
+ENDIF
5
+FILE$ = TOKENIZE$(ARGS$, " ")
6
+SEARCH$ = LOWER$(ARGS$) ' Everything that remains
7
+FH = OPENIN(FILE$)
8
+IF FH < 0 THEN
9
+ PRINT "Unable to open file: "; FILE$
10
11
12
+LS$ = ""
13
+LN = 1
14
+F = 0
15
+REPEAT
16
+ BYTE = READ(FH)
17
+ LS$ = LS$ + CHR$(BYTE)
18
+ IF BYTE = 10 THEN
19
+ IF INSTR(LOWER$(LS$), SEARCH$) > 0 THEN
20
+ PRINT LN; ":", LS$;
21
+ F = F + 1
22
+ ENDIF
23
+ LS$=""
24
+ LN = LN + 1
25
26
+UNTIL EOF(FH) = 1
27
+CLOSE FH
28
+IF F > 0 THEN
29
+ PRINT ""
30
+ PRINT F; " matches found."
31
+ELSE
32
+ PRINT "No matches found."
33
0 commit comments