Commands by marcolino (2)

  • Identify Movies but NOT TV Series using find and regex While it's easy to find video files, it's not easy to check wheter they are Movies or part of TV Series; this could be important if you need to move files before cataloguing them. Using Regex this could become possibile. Normally TV Series are names with Season and Episode numbers in the file name, this way: "X-Files S01E12 - Gna gna gna.avi" or "3x04.Falling.Skies.-.The.Revenge.mkv" and so on. This RegEx will find correct Episodes if they have the structure "S00E00" or "0E00" or "S00x00" or "0x00". Inversing RegEx makes the trick to find out Movies.


    0
    find . -type f -regextype posix-extended ! -regex '^.*[S|s|\.| ]{0,1}[0-9]{1,2}[e|x][0-9][0-9].*\.(avi|mkv|srt)$' \( -iname "*.mkv" -or -iname "*.avi"-or -iname "*.srt" \)
    marcolino · 2017-05-08 10:56:21 22
  • While it's easy to find video files, it's not easy to check wheter they are Movies or part of TV Series; this could be important if you need to move files before cataloguing them. Using Regex this could become possibile. Normally TV Series are names with Season and Episode numbers in the file name, this way: "X-Files S01E12 - Gna gna gna.avi" or "3x04.Falling.Skies.-.The.Revenge.mkv" and so on. This RegEx will find correct Episodes if they have the structure "S00E00" or "0E00" or "S00x00" or "0x00". In case you should need to find Movies but NOT TV Series, you have to inverse the RegEx when finding video files: find . -type f -regextype posix-extended ! -regex '^.*[S|s|\.| ]{0,1}[0-9]{1,2}[e|x][0-9][0-9].*\.(avi|mkv|srt)$' \( -iname "*.mkv" -or -iname "*.avi"-or -iname "*.srt" \)


    0
    find . -type f -regextype posix-extended -regex '^.*[S|s|\.| ]{0,1}[0-9]{1,2}[e|x][0-9][0-9].*\.(avi|mkv|srt)$'
    marcolino · 2017-05-08 10:16:07 22

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Compare two directory trees.
This uses Bash's "process substitution" feature to compare (using diff) the output of two different process pipelines.

Rename .JPG to .jpg recursively
This command is useful for renaming a clipart, pic gallery or your photo collection. It will only change the big caps to small ones (on the extension).

a function to find the fastest DNS server
http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

See OpenVZ Container id's of top 10 running processes by %cpu
This command will list the PID, VEID, and Name of the 10 highest cpu using processes on a openvz host. You must have vzpid installed.

command to change the exif date time of a image

increase recursively the modification time for a list of files
Increase the modification date for the files selected with the find command.

Check the current price of Bitcoin in USD

Indent a one-liner.
Bash builtin type also indents the function.

Adding Prefix to File name


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: