grep_usage
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
grep_usage [2023/08/17 14:37] – [wordscapes] raju | grep_usage [2023/09/07 21:03] (current) – [repeat previous character N times] raju | ||
---|---|---|---|
Line 57: | Line 57: | ||
% grep -Ei " | % grep -Ei " | ||
unused | unused | ||
+ | </ | ||
+ | |||
+ | ==== print lines with less than a certain number of characters ==== | ||
+ | To print lines that contain less than N characters | ||
+ | < | ||
+ | grep -Ev " | ||
+ | </ | ||
+ | |||
+ | For example: | ||
+ | To print lines that contain less then 6 characters | ||
+ | < | ||
+ | grep -Ev " | ||
+ | </ | ||
+ | |||
+ | You can also do | ||
+ | < | ||
+ | grep -v " | ||
+ | </ | ||
+ | where the . is repeated N times. This is easier to type for small N. | ||
+ | |||
+ | Sample run: | ||
+ | < | ||
+ | $ cat data.txt | ||
+ | a | ||
+ | ab | ||
+ | abc | ||
+ | abcd | ||
+ | abcde | ||
+ | abcdef | ||
+ | abcdefg | ||
+ | |||
+ | $ grep -v " | ||
+ | a | ||
+ | ab | ||
+ | abc | ||
+ | abcd | ||
+ | abcde | ||
+ | |||
+ | $ grep -Ev " | ||
+ | a | ||
+ | ab | ||
+ | abc | ||
+ | abcd | ||
+ | abcde | ||
</ | </ | ||
grep_usage.1692283037.txt.gz · Last modified: 2023/08/17 14:37 by raju