So I have a file with a number of records that look like the following:
Peugeot:206:2000:Red:1
And I'm trying to grep search for any that contain a year 1995-1999. I have tried
grep '[1995-1999]' file.txt
to no avail. Any ideas? Thanks.
grepsearch
So I have a file with a number of records that look like the following:
Peugeot:206:2000:Red:1
And I'm trying to grep search for any that contain a year 1995-1999. I have tried
grep '[1995-1999]' file.txt
to no avail. Any ideas? Thanks.
Best Answer
This one is easy:
does the job. It is easy, because the intended number range matches a character code range. For a more complicated example, e.g., 1998-2003, you will have to split the range appropriately: