Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Darkest Log

Posted on 2013-11-13
3
Medium Priority
?
263 Views
Last Modified: 2013-11-13
I have a large number of log files, that consist of only a hex based 'html' rgb color code. So a log file might be called blah.log, and inside of it, it will have only one 'word'. The 'word' is a html color value between 000000 and FFFFFF. That value is basically 3 different values between 00 and FF, put together for the RGB value of the color.

What I would like to do is to take all .log files, open them to find the value, and then order the log file names in a list from lightest to darkest. From 000000 to FFFFFF.

So, if the log files were called 1.log, 2.log, and 3.log and they were each darker than one before it, the result would be:

1.log
2.log
3.log

Does that make sense?
0
Comment
Question by:stakor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 39644001
Is this what you mean?
perl -ne '$d{pack"n",unpack"%C*",pack"H6",$_}=$ARGV;END{rename $d{$_},++$n.".log" or warn "$d{$_} $n.log $!" for sort keys %d}' *.log
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 39644129
Maybe it's more likely that you mean this:
perl -lne '$d{pack"n",unpack"%C*",pack"H6",$_}=$ARGV;END{print $d{$_} for sort keys %d}' *.log
0
 

Author Closing Comment

by:stakor
ID: 39646269
Thank you.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question