Coding for All
Level 15: Searching Inside a File
Searching Inside a File Look for a word without reading the whole file.

FIND searches inside a file and prints every line containing the text you asked for. The text must go in double quotes, which is one of the few places MS-DOS insists on them.

It prints the filename as a heading first, which is how you tell the results apart when you search several files at once. FIND is fussy about capital letters unless you add the /I switch.

CLS clears the screen, leaving just a fresh prompt at the top. It prints nothing, because wiping the screen IS the output. It is the tidiest command in MS-DOS, and after a long DIR it is a relief.

FIND "HELP" README.TXTLines containing HELP.
FIND /I "help" README.TXTIgnore capitals.
CLSClear the screen.
Your task
  • Search README.TXT for a word with FIND
  • Clear the screen with CLS

Open this level in your browser to type the commands at a live terminal that answers back.