[SlugBug] Re: data formatting query

Bill Best bill.best at commedia.org.uk
Thu Dec 8 21:43:20 GMT 2005


hi

Craig Andrews wrote:

> Stick this in-between the grep and the sort:
> 
> perl -pe 's/(\d{2})(\d{2})(\d{2})/$3$2$1/'
> 
> The total command would be:
> 
> awk '{ print $1, $2 }' < inputfile | grep -v '^$' |\
> perl -pe 's/(\d{2})(\d{2})(\d{2})/$3$2$1/' | sort | uniq

they used to burn people at the stake for this sort of wizardry :o)

but anyhow the above still doesn't quite do it for me - i get this sort 
of thing:

>> 010705
>> 010805
>> 010905
>> 011005
>> 011105
>> 011205
>> 020705
>> 020805
>> 020905
>> 021005
>> 021105
>> 021205
>> 030705
>> 030805
>> 030905
>> 031005
>> 031105
>> 040705
>> 040805
>> 040905
>> 041005
>> 041105
>> 050705
>> 050805
>> 050905
>> 051005
>> 051205

a problem is that i think this data is listing every working day since 
010705.  i thought that it would be giving me the odd day here and the 
odd day there when an event happened (alarm activation) - but i have 134 
lines.

i might eventually get the data i want from the suppliers so from a 
curiosity point of view we could still keep cracking at this.

many thanks for all the suggestions so far.

bill best


More information about the SlugBug mailing list