Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
which parses the following line and extracts the clip length ("15000" in this case)
The code works, the only problem is that the script I'm writing needs to perform this extraction somewhere on the order of 60,000 times per day of video files being checked. I'm thinking that it might run a bit faster if I can somehow combine the two awk statements into a single one.
Is there a simple way to do this? It would be trivial if the file separators were all the same but with little awk experience I don't really know how to handle the mix of "_" "__" and "."
...dropped the runtime for 5 days from just under 30 minutes to just under 1 minute. I didn't think it would be that big of a difference but I guess when you run those 2 awk commands a couple tens of thousands of times it really adds up.
Anyways, thanks a lot Firerat you just made my day! Just out of curiosity could you explain how those two lines work? I take it the first one sets videoLength to everything after the "__" and the second one then sets it to everything before the ".mp4". I've never seen that syntax but it works extremely well so I'll take it.
szboardstretcher thank you too, although when I just copied and pasted that code it spat back a bunch of errors. I couldn't really tell you why but oh well.
So, is this a list of file names or are you operating on individual files ? It is usually faster to operate on lists.
Right now it is operating on single files within a for loop:
for video in $(ls)
I'm pretty happy with the speed now but would it be faster to load these into a list and perform the operation on the list as a whole? It seems like how I have it is the most efficient since it has to increment the total time after each iteration, but I could be wrong.