Introduction
The shell scripting language is packed with all the essential problem-solving components for Unix/Linux systems. Text processing is one of the key areas where shell scripting is used, and there are beautiful utilities such as sed
, awk
, grep
, and cut
, which can be combined to solve problems related to text processing.
Various utilities help to process a file in fine detail of a character, line, word, column, row, and so on, allowing us to manipulate a text file in many ways. Regular expressions are the core of pattern-matching techniques, and most of the text-processing utilities come with support for it. By using suitable regular expression strings, we can produce the desired output, such as filtering, stripping, replacing, and searching.
This chapter includes a collection of recipes, which walk through many contexts of problems based on text processing that will be helpful in writing real scripts.