Showing posts with label Using RegEx in find command. Show all posts
Showing posts with label Using RegEx in find command. Show all posts

Monday, January 7, 2013

Using RegEx in find command

Below shown are the examples for using Regular Expression in 'find' command:

[ashok@linuxhost workdir]$ find . -type f -regex ".*[0-9]+.txt" -print 2> /dev/null
./1322143.txt
./anything_134.txt
./12345_837.txt
./something10984.txt

[ashok@linuxhost workdir]$ find . -type f -regex ".*/[0-9]+.txt" -print 2> /dev/null
./1322143.txt
[ashok@linuxhost workdir]$