Parse m3u playlist file for total time

awk -F":|," '{RS="#"; sec+=$2}END{h=(sec/3600);m=((sec/60) % 60);s=(s;printf("%02d:%02d:%02d\n", h, m, s)}' file.m3u
Parse an m3u file with seconds for each item and output the length of the entire playlist
Sample Output
03:13:37

0
By: jonavon
2020-05-16 18:55:32

What Others Think

thanks for an amazing article onmovies app
moksha456 · 1 week and 4 days ago
https://www.apkspree.com/showbox-apk/ https://www.apkspree.com/tea-tv-apk/ https://www.apkspree.com/savefrom-net-apk-download/ https://www.apkspree.com/hotstar-apk-download/
chepkobeer · 1 week ago
Well, I love making playlist especially when I was young. You love to focus on the songs that you want to hear more often, sand I see nothing is wrong with that. Based on what i read from http://www.bestwritingservicecanada.com/">http://www.bestwritingservicecanada.com/, it is a good habit to make your own playlist.
janedeleon · 3 days ago
Well, I love making playlist especially when I was young. You love to focus on the songs that you want to hear more often, sand I see nothing is wrong with that. Based on what i read from http://www.bestwritingservicecanada.com">bestessay , it is a good habit to make your own playlist.
janedeleon · 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

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



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: