LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-08-2013, 06:55 PM   #16
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444

you need regular expressions

man find
Code:
....
      -iregex pattern
              Like -regex, but the match is case insensitive.
....
       -regex pattern
              File name matches regular expression pattern.  This is a match on the whole path, not a search.  For example, to match a file named `./fubar3', you can use the regular expression  `.*bar.'
              or `.*b.*3', but not `f.*r3'.  The regular expressions understood by find are by default Emacs Regular Expressions, but this can be changed with the -regextype option.
....
Code:
find . -iregex ".*\.\(\<mp3\>\|\<flac\>\|\<ogg\>\)"
Damn ugly....

so
Code:
...
       -regextype type
              Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line.
Currently-implemented types are emacs (this is the default), posix-awk,
              posix-basic, posix-egrep and posix-extended.
...


Code:
 find -regextype posix-egrep -iregex "*.*(mp3|flac|ogg)"
easier to write and read

but you could do
Code:
find . -iname "*.mp3" -o -iname "*.flac" -o -iname "*.ogg"
search regular expression , for tutorials
 
1 members found this post helpful.
Old 10-08-2013, 10:36 PM   #17
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,102

Rep: Reputation: 181Reputation: 181
Cool

Quote:
Originally Posted by kilee View Post
Thank you all.

This has helped me a lot!
One aditional question. Is it possible to define a list of extensions extensions? let's say using this with the find command?

--include-from=/Users/me/Desktop/list.txt --include=*/ --exclude=*

Where List.txt includes all the possible extensions I need to move?

THanks!
try this one:

Code:
while read line; do 
    

   find / -iname $line -type f -exec /bin/mv {} /home/mynewfolder \;

done < List.txt
Good luck!!!
 
1 members found this post helpful.
  


Reply

Tags
find


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron tab error: No entry for terminal type "unknown"; sing dumb terminal settings. shlomi.s Linux - Software 12 09-06-2011 10:20 AM
terminal error? decksmasher Linux - Software 3 08-17-2009 04:42 PM
Error opening terminal:vt102 and error while loading shared libraries:libncurses.so.5 nathan Linux - Software 1 08-12-2009 12:03 AM
Error opening terminal: xterm Terminal type "xterm" unknown Pscylo Slackware 10 04-17-2009 07:33 AM
gnome-terminal error AceTech747 Linux - Software 4 01-04-2004 06:21 PM


All times are GMT -5. The time now is 06:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration