Is it possible to locate files in a directory that have strings (with no spaces) longer than x length?
Linux – grep to find files that contain a string greater than x characters long
greplinuxregular expressions
Related Topic
- Find files containing a string on the whole filesystem
- Grep to display folders which contain files which contain a string
- Linux – find all directories having less than x files inside
- How to grep through binary files that look like text
- Linux – How to find files that don’t contain a given search string
- Linux: find files from a list in txt, the files contain spaces
Best Answer
I consider myself a regex noob, but I created a bunch of files with variable length strings in them and I think I got what you wanted, try this:
user@host$ grep -e '[^\ ]\{7,\}' *
For those who don't quite understand this:
-e
makes grep search using a regex.[^\ ]
means to match a single character except space.\{7,\}
means to match a string of 7 or more characters. If you were to put another number afther , it would be strings between 7 and x characters.