TTYGod
Articles / Workflow

Find the note that mentions a blue envelope

You remember putting the pickup instructions in a text file. The date, the filename and the folder have slipped your mind. What stayed with you is the phrase “blue envelope.” That fragment is enough to make a small, repeatable search.

TTYGod editorial desk · AI-assisted launch edition · Issue ·
Share WhatsAppLinkedInEmail
Mechanical keyboard and paper notes
Mechanical keyboard and paper notes · AI-generated editorial illustration
תקציר בעברית

אתם זוכרים את המילים ״מעטפה כחולה״ אבל לא את שם הקובץ? תרגיל חיפוש מקומי מראה איך למצוא את ההתאמה ולקרוא מהפלט את שם הקובץ ואת מספר השורה.

Give yourself a known match

Use a text editor to make a new practice folder. Save two plain text documents inside it. Call the first one errands.txt and give it two lines, “Collect the parcel” and “Take the Blue Envelope.” Give the second file, ideas.txt, the single line “Try the blue notebook.” Open a terminal in the practice folder. Type pwd to see where the shell is looking. Folder choice matters because a search from the wrong starting point can give a perfectly reasonable empty answer. Read the grep manual.

Ask a literal question

Run grep -inF 'blue envelope' ./*.txt in the practice folder. The command prints the name of the errands file, a line number of two and the matching line. The letter i makes the capital B and E irrelevant. The n asks for a line number. The capital F treats your phrase as ordinary text, which is especially handy when you later remember a price or a filename containing a dot. The quotes keep the phrase together as one argument.

Mechanical keyboard and paper notes
Mechanical keyboard and paper notes · AI-generated editorial illustration

Widen the search deliberately

Remove envelope from the quoted phrase and run the command again. You should find both notes. In a real notebook this is a useful second pass when someone might have written “blue mailing envelope.” If both searches produce too many results, add another remembered word and inspect the surrounding lines in your editor. Keep the original accent, punctuation and spacing in mind when a familiar phrase seems strangely absent.

Carry the result back to the document

Open errands.txt in your editor and jump to line two. The output records the location at the instant you searched. Adding a heading above that line tomorrow changes the number. For a durable reference, save the filename and a short quote in your index. This exercise searches plain text files immediately inside one folder. Word documents, PDFs and nested folders need a different approach. When moving to a larger collection, write down your successful phrase so that a colleague can reproduce the search on the same folder. For further reading, browse command line for beginners books.

Before you begin

Which part of the output takes you directly to the passage?

Check your result

In this example, errands.txt and line 2 identify the passage. Search again after editing the document.

Reference · Read the grep manual

Bookshop.org

For further reading, browse the bookshop catalogue and compare titles and editions.

This merchant link currently earns this publication no commission. Affiliate disclosure

Browse command line for beginners books

Reader notes

Read community notes

No reader notes yet.

Related articles

Notebook beside a terminal monitor
Issue ·
Workflow

Track down a missing draft by its filename

A friend asks for the handout you prepared last month. You remember calling it a draft, and you have a folder full of workshops, but the contents of those folders stretch over several years. Search the names before opening every document.

Laptop on a dark desk
Issue ·
Workflow

Turn a messy packing list into a useful tally

Three people send lists for a picnic and all three volunteer to bring cups. Before assigning anyone another job, put one item on each line and see which promises overlap. This exercise works entirely in a terminal and keeps the original list intact.

Portable drive beside a keyboard
Issue ·
Workflow

Measure a draft without counting its headings twice

You have a short reading to deliver and the organiser has given you a word limit. A terminal count can give you a quick baseline, provided you decide which parts of the draft belong in the count. A tiny sample makes the conventions visible.