» Make grep CLI App in Python » 1. Introduction » 1.1 Preparation

Preparation

Install Python

See How to install Python?.

This project uses Python 3.8.13 and pip 21.3.1 for Python 3.8.

Pick an editor

Pick your favorite editor or use Visual Studio Code.

Learn Python basics

If you're not familiar with Python, you may try this tutorial: "Quick Introduction to Python."

What is a CLI app

See What is a CLI app?.

What is grep

The grep command is a powerful Unix/Linux utility used for searching text patterns within files. It stands for "Global Regular Expression Print." grep allows you to search for a specific pattern or regular expression in a file or a stream of text and print the lines that match the pattern.

By default, a pattern matches an input line if the regular expression (RE) in the pattern matches the input line without its trailing newline. An empty expression matches every line. Each input line that matches at least one of the patterns is written to the standard output.

Here's a basic usage example:

grep pattern file.txt