Pages

Thursday, March 20, 2014

find which lines in a file are longer than N characters

$ while read i; do [ ${#i} -gt 72 ] && echo "$i"; done < /path/to/file

Filter out lines of input that contain 72, or fewer, characters.


This uses bash only. ${#i} is the number of characters in variable i.




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/NwUPFj

No comments:

Post a Comment