April 2018
Beginner
284 pages
7h 3m
English
You can specify a range of characters to match between square brackets as follows:
[a-d]
This means the range of characters from a to d, so a, b, c, and d are included.
Let's use the same previous example file:
$ awk '/[a-m]ash/{print $0}' myfile$ sed -n '/[a-m]ash/p' myfile

The character range from a to m is selected. The third line contains r before ash, which is not in our range, so only the second line doesn't match.
You can use numbers ranges as well:
$ awk '/[0-9]/'
This pattern means from 0 to 9 is matched.
You can write multiple ranges in the same bracket:
$ awk '/[d-hm-z]ash/{print $0}' myfile$ sed -n '/[d-hm-z]ash/p' ...