2025-10-28 18:39:57 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Demonstrate a more complex regular expression to detect matching words in
|
|
|
|
|
# a file (one per line)
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
re='\<.{4,}[tl]ing\>'
|
|
|
|
|
|
|
|
|
|
while read -r line; do
|
|
|
|
|
if [[ $line =~ $re ]]; then
|
|
|
|
|
echo "$line"
|
|
|
|
|
fi
|
|
|
|
|
done < <(shuf -n 100 /usr/share/dict/words)
|