#!/bin/bash
# Demo using `grep` with the `-E` option
# Search for lines containing the word "sample"
grep -E 'sample' sample.txt
# Search for lines starting with the word "It"
grep -E '^It' sample.txt
# Search for lines ending with the word "works!"
grep -E 'works!$' sample.txt
# Search for lines containing either "file" or "text"
grep -E 'file|text' sample.txt
# Search for lines containing the word "text" followed by zero or more characters
grep -E 'text.*' sample.txt
# Search for lines containing the word "sample" followed by any single character
grep -E 'sample.' sample.txt
# Search for lines containing some letters
grep -E '[a-zA-Z]' sample.txt