commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Better awk example, using only mplayer, grep, cut, and awk.
There are 3 alternatives - vote for the best!
change the *.avi to whatever you want to match, you can remove it altogether if you want to check all files.
You're behind on your TV catch-up, but how far behind? This command tries to open mplayer against all files in the current dir. If it's a video file it will contain ID_LENGTH, which is summed and output in hours, minutes and seconds.
Someone better at awk could probably reduce this down a lot.
Use case insensitive regex to match files ending in popular video format extensions and calculate their total time. (traverses all files recursively starting from the current directory)
If you can do better, submit your command here.
You must be signed in to comment.