shell script search for one or more whitespace regular expression
Posted on 2010-04-01
I have a shell script where I run du -sh on a directory, and if I want to find all Mb files, I run this line in my script:
du -sh $DIR/* 2>/dev/null|grep -v [0-9][Mm]|sort -nr
The problem I have with this line is that if there's files with other digits and M in the name, it matches those too, like this:
So I want to match the whitespace that occurs after the M in 146M. But I can't find the exact regular expression to do this in a shell script. Can someone pass this along? Thanks!