Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 837

Comment by Kamil Maciorowski on How do I grep the first 50 lines of each file in a directory recursively?

$
0
0
grep -q "matching string here" < <(head -n 50 "$1") is a somewhat convoluted, non-portable (almost-)equivalent of head -n 50 "$1" | grep -q "matching string here". The latter syntax is straightforward and portable; it does not require bash, will work with sh -c.

Viewing all articles
Browse latest Browse all 837

Trending Articles