in reply to log file sorting
Also please read Writeup Formatting Tips, please use <code>...</code> tags only for code, and paragraphs <p>...</p> for text.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: log file sorting
by numberninja (Initiate) on Aug 04, 2008 at 16:14 UTC | |
this is relevant part of the program i have so far, which sorts each data label alphabetically. As I was unsure of how to count how many distinct numbers followed a label, i tried to fill in non existant data with substitutions, which was merely a temporary fix. I havent even begun attempting to get the data organized into nice excel-esque columns, as that would first require standardizing its appearance. | [reply] [d/l] |
by moritz (Cardinal) on Aug 04, 2008 at 16:31 UTC | |
ah, thanks for notifying me about the paragraph tags, i somehow missed them reading about them No problem. Just go to your original question and fix the markup. As for your programming problem, I think you're making it harder than it needs to be. For example there's no need to store your data to disk twice, and read it again. Here's what I'd do, in non-tested perl code, with some blanks left for you to figure out:
The idea is to keep a list of all data values for each label, in your case ['#', '#'] for A1, ... The choice of a clever data structure (ie one that fits the way you want to access it in your code) makes it much easier. | [reply] [d/l] [select] |
by numberninja (Initiate) on Aug 04, 2008 at 17:30 UTC | |
just to make sure i understand your programming template: the first part does something similar to my program and splits the data according to commas, then has a space where i can count the occurrences of numbers following a label? I considered using the count function and looking for instances of \D\d{0,3}, but i don't see how to limit the count to only the area between the label and the comma. However, this doesn't really shed any light on how i can store the multiple instances of "A" in one line as seperate values. edit: now i've gotten it to count the number by having it search for \D\d{1,3}, and then storing that value to a hash with the key being the label. Every line i recheck the count, and if its greater, i replace the old value. | [reply] |