Find and Replace (CLI)¶
Current Status¶
The CLI backend does not have built-in Find/Replace commands. The CLI follows the classic MBASIC-80 command set, which did not include these features.
Alternative Methods¶
Finding Text in Your Program¶
Method 1: LIST with Line Ranges¶
Search visually by listing portions of your program:
LIST 100-200 ' List lines 100 to 200
LIST 500- ' List from line 500 to end
LIST -100 ' List from start to line 100
Method 2: Save and Search Externally¶
Then use shell commands:Method 3: Use LIST and Visual Scan¶
Scroll through output to find text.Replacing Text¶
Method 1: Direct Line Replacement¶
To replace text, retype the entire line:
Method 2: Delete and Re-enter¶
Method 3: External Editor¶
Edit in external editor, then:Batch Operations¶
Replacing Variable Names¶
If you need to rename a variable throughout your program:
-
Save the program:
-
Use external tools:
-
Load modified version:
Finding All Occurrences¶
To find all uses of a variable or statement:
In shell:
Using Other UIs¶
For built-in Find/Replace, use the Tk UI:
Tk UI provides: - {{kbd:find:tk}} for Find dialog - {{kbd:replace:tk}} for Replace dialog - F3 for Find Next - Visual highlighting
Tips for CLI Users¶
- Use meaningful line numbers - Group related code
- Comment your code - Makes visual searching easier
- Keep procedures together - Related SUBs in sequence
- Use consistent naming - Easier to find/replace manually
Why No Find/Replace in CLI?¶
The CLI maintains compatibility with original MBASIC-80, which predated modern text editing features. The CLI focuses on: - Authentic classic experience - Command-line automation - Batch processing - Testing and debugging
For modern editing conveniences, we recommend the Tk or Web UIs.
Examples¶
Example: Finding a Subroutine¶
Example: Replacing a PRINT Statement¶
Example: Finding All GOSUBs¶
See Also¶
- CLI Commands - Basic CLI operations
- Debugging Commands - CLI debugging features
- Tk Features - Modern UI with Find/Replace