perl -wsne '/$r/ && print' -- -r='your regexp here' *.txt