Book Image

Command Line Fundamentals

By : Vivek Nagarajan
Book Image

Command Line Fundamentals

By: Vivek Nagarajan

Overview of this book

The most basic interface to a computer—the command line—remains the most flexible and powerful way of processing data and performing and automating various day-to-day tasks. Command Line Fundamentals begins by exploring the basics, and then focuses on the most common tool, the Bash shell (which is standard on all Linux and iOS systems). As you make your way through the book, you'll explore the traditional Unix command-line programs as implemented by the GNU project. You'll also learn to use redirection and pipelines to assemble these programs to solve complex problems. By the end of this book, you'll have explored the basics of shell scripting, allowing you to easily and quickly automate tasks.
Table of Contents (6 chapters)

Chapter 3: Advanced Command-Line Concepts

Activity 8: Word Matching with Regular Expressions

The commands to be used to answer the questions can be found here:

  1. The following command can be used to find the number of words that are five letters in length, begin with a consonant, and contain alternating vowels and consonants:
    grep -c -E '^([^aeiou][aeiou]){2}[^aeiou]$' <words.txt
    506
  2. Use the following command to find the number of words that are two or more characters long, begin with a consonant, and contain alternating consonants and vowels:
    grep -c -E '^([^aeiou][aeiou])+[^aeiou]?$' <words.txt
    2339
  3. Use the following command to count the three-letter words that start and end with the same letter:
    grep -c -E '^(.).\1$' <words.txt
    23
  4. The following command can be used to find the number of words that have the same vowel repeating twice consecutively in it:
    grep -c -E '([aeiou])\1' <words.txt
    1097 
  5. The following...