I have a textfile with a number of lines, and I would like that each line that matches the pattern is saved to another textfile (up to maxnumberofmatches lines).
Is this possible at all (or can pattern only contain word characters and not meta characters?), or would a totally different way to get closer to this problem be better?
Comment on (How) can I use regex patterns to find matching lines in a textfile?
You have to type only the word you want to find.
If you want to be able to make it like the example you posted (with metachars). then replace /$ARGV[1]/ for eval($ARGV[1]).