ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm not even going to try to guess without some more background info. Care to explain what your script is supposed to do?
How about giving us an example of the input it's supposed to be processing? What is the expected output, and what is the actual output you get? What else do we need to know to understand what the script is doing? Be specific.
Also, your formatting is highly unreadable. I had to take several minutes just to break it up into something more easily understandable. Here it is with each command given its own line, but with no other changes made.
I can already predict that there's a lot of unnecessary duplication of commands here. Indeed, if we knew what it's supposed to be doing, it's likely the whole thing could be done entirely in a single awk script.
2) sort has a -u option that does the same thing as uniq.
3) Your script doesn't include definitions for most of the variables used. For example, I'm assuming that $INPUTRaw$DDay1$CHour1$CMin2 references a file name. What's in it? Where are the components that make up this string defined? There must be more to this script than what you've shown.
4) Why use the -a option in grep anyway? That's only used for processing binary files, but your script makes it clear that the input is text. Again, what's the intended output of the command?
5) (added) It looks to me like you have one big awk code block duplicated 4 times. That means that the command could easily be redefined as a single function, at the very least. Write once, use many.
Last edited by David the H.; 05-02-2011 at 08:17 AM.
Reason: addendum
Welcome to LQ. Glad to see you jump in w/ a Programming question.
Also, thanks for using "Code:" blocks, at all -- they're much easier to read than the alternatives.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.