gargamel100
Technical User
Hi all,
I have some huge file and I want to check it on some values so I wrote script bellow
###################################################################
cat 942prm_$d | tr ' | ' ' ' > prm942_$d.txt # to translate | into empty space
d=`TZ=MET+24 date +%Y%m%d` # date
# And awk rule...
awk ' { if ( ($10==50005) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
awk ' { if ( ($10==50006) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
awk ' { if ( ($10==50007) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
#######################################################################
if colummn $10 is 50005 and $22 is 128 and $12 begins with 61 or 62 and length of that line is not smaller that 8 I need to print colummn $10 and $12 and I made it with above awk comand. Where is colummn $1 represent called number and colummn $12 calee number.
Now I need just small hint ( help ) how count how many times each case occur. I need output like this,
50005---------------4 ( means: the awk rule was ok 4 times for number 50005 )
50006---------------5 ( as above, just five times for number 50006)
50007---------------6 ( as above, just six times for number 50007)
in file mobilna.txt.
In other words how many times some customer which phone number begins with 61 or 62 called number 50005—first awk command, number 50006---second awk command, 50007 --- third awk command and so on.
What I want to say, if rules in awk command
awk ' { if ( ($10==50005) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
occurs some number of times for number 50005, I need to get output like above. I need to know how many time occurs that. I probably need some kind of counter but I do not know how implement that.
Every help or hint is welcome.
Thanks
I have some huge file and I want to check it on some values so I wrote script bellow
###################################################################
cat 942prm_$d | tr ' | ' ' ' > prm942_$d.txt # to translate | into empty space
d=`TZ=MET+24 date +%Y%m%d` # date
# And awk rule...
awk ' { if ( ($10==50005) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
awk ' { if ( ($10==50006) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
awk ' { if ( ($10==50007) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
#######################################################################
if colummn $10 is 50005 and $22 is 128 and $12 begins with 61 or 62 and length of that line is not smaller that 8 I need to print colummn $10 and $12 and I made it with above awk comand. Where is colummn $1 represent called number and colummn $12 calee number.
Now I need just small hint ( help ) how count how many times each case occur. I need output like this,
50005---------------4 ( means: the awk rule was ok 4 times for number 50005 )
50006---------------5 ( as above, just five times for number 50006)
50007---------------6 ( as above, just six times for number 50007)
in file mobilna.txt.
In other words how many times some customer which phone number begins with 61 or 62 called number 50005—first awk command, number 50006---second awk command, 50007 --- third awk command and so on.
What I want to say, if rules in awk command
awk ' { if ( ($10==50005) && ($22==128) && ( $12~/^61/) || ($12~/^62/) && length($12) <= 8) print $10; print $12 }' prm942_$d.txt > mobilna.txt
occurs some number of times for number 50005, I need to get output like above. I need to know how many time occurs that. I probably need some kind of counter but I do not know how implement that.
Every help or hint is welcome.
Thanks