-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.sh
50 lines (37 loc) · 860 Bytes
/
demo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/bash
# Russ Ferriday
# 2011-02-06
echo 'operating on patterns'
grep "[0-9]*\-[0-9]*\-[0-9]*" census-spaced
echo ""
echo 'alternative syntax - note the additional [] as part of the predefined class symbols'
grep "[[:digit:]]*\-[[:digit:]]*\-[[:digit:]]*" census-spaced
echo ""
echo 'Bracket expressions ...'
grep b[aeiou]g basicregex
echo ""
echo 'Range expressions ...'
grep a[2-4]z basicregex
echo ""
echo 'Single character ...'
grep a.z basicregex
echo ""
echo 'Start and end of line ...'
grep '^water' basicregex
grep 'water$' basicregex
echo ""
echo 'repetition...'
echo 'zero "a"s...'
grep bd basicregex
echo ""
echo 'zero or more "a"s...'
grep ba*d basicregex
echo ""
echo 'at least one "a"...'
grep -E 'ba+d' basicregex
echo ""
echo 'zero or one "a"...'
grep -E 'ba?d' basicregex
echo ""
echo "Abe... "
grep A.*Lincoln basicregex