?
Solved

Darkest Log

Posted on 2013-11-13
3
Medium Priority
?
258 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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
Suggested Courses

801 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