[CentralOH] Goggles For Searching: grep
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Sun Jul 17 16:23:28 EDT 2016
On Fri, 15 Jul 2016 11:15:13 -0400 (EDT), R P Herrold <herrold at owlriver.com> wrote:
> [herrold at centos-7 pw]$ grep glasses * 2> /dev/null | grep type
> arlington_optical:type: glasses (a local vendor of
> sporting 'high impact' eyewear)
> edgeeyewear:type: glasses
> goggles4u:type: glasses
> northwest_optical:type: glasses
Thanks for that real-life example
of what has been encouraged at the dojos:
Save notes in plain text files.
That makes them very easy to search.
That simple technique follows several precepts
as summed up by Mike Gancarz[1]:
1. Make each program do one thing well.
R P Herrold used grep.
grep looks for stuff.
That's all it does.
It does it well.
4. Choose portability over efficiency.
Plain text files are remarkably portable.
They work in all the common operating systems.
You can put them up on the web,
and everyone can read them.
At worst, one might need to add a '.txt' filename ending
and fuss with line endings for some operating systems.
Compare that with the portability just between
various versions of Microsoft Word.
5. Store data is flat text files.
That makes them easy to work with and easy to debug.
You don't need any special programs to look at them
and there are many utilities that grok[2] plain text,
but much fewer that grok non-plain text formats
such as but not limited to Microsoft Word.
How do you know if the format of a Microsoft Word
document is messed up or not?
How would you search 100 Microsoft Word documents?
That is trivial with plain text files.
6. Use software levearge to your advantage.
grep worked great for this.
8. Avoid captive user interfaces.
Done.
Imagine searching 100 documents from _within_ Microsoft Word.
9. Make every program a filter.
This makes them easy to combine to do amazing stuff
that individually they are not able to do.
"Filter" is an artful term for a simple I/O structure for
programs: Listen to (standard) input and talk to (standard) output.
Unix shells allow one to easily combine simple "filter" programs
to do amazing stuff.
[1] https://en.wikipedia.org/wiki/The_unix_philosophy#Mike_Gancarz:_The_UNIX_Philosophy
[2] http://www.merriam-webster.com/dictionary/grok
More information about the CentralOH
mailing list