Saturday, May 23, 2009

finding and removing certain files in Linux shell

To recursively search all the *.ogg files under the current dir (denoted by .) and delete them, in Linux shell, type:

find . -name \*.ogg -exec rm {} \;

Tuesday, May 12, 2009

Matching an empty string in a cellstring array in Matlab

Say you have the following cellstring array in Matlab :
a =
{'0.13'
'0.48'
'0.11'
'0.1'
''
''
'0.03'
'0.22'
'0.09'
'0.29'
'0.14'
'0.33'}

In order to match the cellstring array rows with empty strings, use :

regexp(a, '^\d')
or
cellfun('isempty', regexp(a, '^\d'))

Here we are taking advantage of the fact that we have all numeric strings. Anybody any idea on how to accomplish this if the non-empty strings were composed of letters?