regex - grep first n rows, return file name only -
i can following search need , return file name: grep -l "mysearchstring" ./*.xml files searching huge takes forever. string searching appear in first 200 rows how can search first 200 rows , still return file name?
you can do:
for file in *.xml; head -200 "$file" | grep -q "mysearchstring" && echo "$file" done
Comments
Post a Comment