I am using the grep -f function to extract lines from a file which match a particular pattern. Let\'s say my pattern file is pattern.txt, as follows.>
grep -f
pattern.txt
Add ^ before your patterns so that grep will match a line start with your pattern. If your pattern is actually set of numbers, You don't need a list of patterns. Just use ^[1-5]:.
^
grep
^[1-5]: