Tuesday, 10 September 2013

grep along with regex perl

grep along with regex perl

I am new to perl, and I am currently stuck on this problem.
I have multiple files in a directory
I want to check their names, and see if the filename matches a certain
keyword (not whole filename). So in conclusion, I want to grab the certain
files that all have a certain keyword, then process them.
I was trying something like
grep -rl "keyword" /.;
#where does the filenames get stored? let's say in $_?
#foreach valid file, do something
from some website I found, but it doesn't seem to work? Help please, Thanks!!

No comments:

Post a Comment