S
surfitupdotcom
I have script that recursively greps for a term and counts the
occurrences of it in each file. It works fine but now I want to
exclude matches where the term has an underscore in front or after
it. I have tried to continue using split on (not underscore)
$search_term(not underscore) in below examples but my results are not
right yet. Input is a string in $grep_out and I want to count any
number of occurrences. I can not break string up into words since a
correct match may not have spaces or any certain character around it.
Let me know if I have not provided enough info, or should post whole
script.... Thanks in advance for any assist, John
Attempts so far:
# @surewords = split(/(?<!\_)${search_term}(?!\_)/im,
$grep_out);
# @surewords = split(/\_{0}${search_term}\_{0}/im,
$grep_out);
@surewords = split(/[^\_]${search_term}[^\_]/im,
$grep_out);
# @surewords = split(/(^|[^\_])${search_term}($|[^\_])/im,
$grep_out);
occurrences of it in each file. It works fine but now I want to
exclude matches where the term has an underscore in front or after
it. I have tried to continue using split on (not underscore)
$search_term(not underscore) in below examples but my results are not
right yet. Input is a string in $grep_out and I want to count any
number of occurrences. I can not break string up into words since a
correct match may not have spaces or any certain character around it.
Let me know if I have not provided enough info, or should post whole
script.... Thanks in advance for any assist, John
Attempts so far:
# @surewords = split(/(?<!\_)${search_term}(?!\_)/im,
$grep_out);
# @surewords = split(/\_{0}${search_term}\_{0}/im,
$grep_out);
@surewords = split(/[^\_]${search_term}[^\_]/im,
$grep_out);
# @surewords = split(/(^|[^\_])${search_term}($|[^\_])/im,
$grep_out);