Generally the one-liners that you might find yourself writing fall into two categories: problems that are too simple or too temporary to ever commit to a file, or problems that are exploratory in nature, where you might eventually write a script but aren’t ready to do so just yet.
Let’s look at an example of the latter, a case of exploring a file to gather information about its contents. The file we’ll be looking at is a log file for the popular web server software Apache. Its error logs look something like this:
[Tue Dec 30 15:25:20 2014] [error] Directory index forbidden
[Tue Dec 30 15:26:11 2014] [notice] caught SIGTERM, shutting down
[Tue Dec 30 15:26:14 2014] [notice] Digest: generating secret ...
[Tue Dec ...