Issue
How can I improve the following command:
grep 'sting' filename
such that to print only the lines with a maximum number of characters? For example only the lines which contain less than 100 characters?
Solution
You can use like this:
egrep '^.{1,100}$' filename | grep 'string'
OR using single awk command line:
awk '/string/ && length($0) <=100' filename
Answered By - anubhava Answer Checked By - Marilyn (WPSolving Volunteer)