05-13-2008
Hi Saniya,
Try this
#!/bin/ksh
count=0
Threshold=5000
while read line
do
val=`echo $line | cut -d" " -f10 | cut -d"=" -f3`
if [ $val -ge $Threshold ]
then
count=`expr $count + 1`
fi
done < 0003080248636880.txt
echo "Number of Values above threshold is $count"
total=`grep -c "interactionCompleted" 0003080248636880.txt`
echo "Total is $total"
s=`echo "scale=4 ; $count/$total" | bc `
echo "Average is $s"
Thanks
Penchal
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Can anyone explain to me why the first line doesn't work and the second seems to work fine. I am trying to find all occurances of text within a certain column (col 13) that start with the character V, I suppose it sounds simple but I have tried using the following but don't really understand what... (2 Replies)
Discussion started by: Gerry405
2 Replies
2. Shell Programming and Scripting
hi,
i have the command nawk -v i want to use it equivalent in awk?
any help please
:) (2 Replies)
Discussion started by: kamel.seg
2 Replies
3. Solaris
Hi
Running a specific nawk statement over a 17m lines files returns the following:
/bin/nawk: not enough args in .....
input record number 1,25955e+06, file test.1
source line number 1
I'd like to report the line number (in bold above) in decimal not floating so that i can spot it out.
... (1 Reply)
Discussion started by: moutaye
1 Replies
4. Shell Programming and Scripting
Hi
Running a specific nawk statement over a 17m lines files returns the following:
/bin/nawk: not enough args in .....
input record number 1,25955e+06, file test.1
source line number 1
I'd like to report the line number (in bold above) in decimal not floating so that i can spot it out.
... (1 Reply)
Discussion started by: moutaye
1 Replies
5. UNIX for Dummies Questions & Answers
Hi ,
i try to filter input file :
17/04/2008 06:17:09
17/04/2008 00:00:02
keeping lines with hour > 06
as :
17/04/2008 06:17:09
i tried :
CSL=06
nawk -v CSL="${CSL}" -F'' '/^\[/ { if ( $4 -gt $CSL) print $0 } ; /^\>/ { if ( $5 -gt $CSL) print $0 }' input_file.txt... (11 Replies)
Discussion started by: Nicol
11 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
I can run the following script using nawk..However, I find that teh server dun support nawk.. May I know how to change teh script to use awk such that it will work? Very urgent.. thx!
nawk 'BEGIN {FS=OFS=","}
NR==FNR{arr=$2;next}
$0 !~ "Documentation"{print $0;next} ... (2 Replies)
Discussion started by: kinmak
2 Replies
7. Shell Programming and Scripting
Hi Guys,
i tried these two commands. First in awk and nawk.
The nawk command is running fine but the awk command is throwing error.
What is wrong with the awk command. There are lot of awk commands running fine in my system
d003:/usr/local/dsadm/dsprod>nawk 'NR = 1 {print " "$0}' a.txt
... (6 Replies)
Discussion started by: mac4rfree
6 Replies
8. UNIX for Dummies Questions & Answers
Hi everyone,
i am new to unix , so i want to know what is the use of awk and nawk.
because in most of the place this cmds were used.
so, if anyone provied the basic idea of this cmds, it will be much helpfull for me . . ..
Thnks in Advance :) (9 Replies)
Discussion started by: natraj005
9 Replies
9. Shell Programming and Scripting
Hi Guys,
I am in need of some help; I have an xml message file which contains personal details as shown below:
, message=, message=, message=, message=, message=, message=
I want to use nawk to parse these xml messages but I am new to awk and nawk.
What I want is to get output... (7 Replies)
Discussion started by: James_Owen
7 Replies
LEARN ABOUT PHP
stream_copy_to_stream
STREAM_COPY_TO_STREAM(3) 1 STREAM_COPY_TO_STREAM(3)
stream_copy_to_stream - Copies data from one stream to another
SYNOPSIS
int stream_copy_to_stream (resource $source, resource $dest, [int $maxlength = -1], [int $offset])
DESCRIPTION
Makes a copy of up to $maxlength bytes of data from the current position (or from the $offset position, if specified) in $source to $dest.
If $maxlength is not specified, all remaining content in $source will be copied.
PARAMETERS
o $source
- The source stream
o $dest
- The destination stream
o $maxlength
- Maximum bytes to copy
o $offset
- The offset where to start to copy data
RETURN VALUES
Returns the total count of bytes copied.
CHANGELOG
+--------+------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+------------------------------+
| 5.1.0 | |
| | |
| | Added the $offset parameter |
| | |
+--------+------------------------------+
EXAMPLES
Example #1
A stream_copy_to_stream(3) example
<?php
$src = fopen('http://www.example.com', 'r');
$dest1 = fopen('first1k.txt', 'w');
$dest2 = fopen('remainder.txt', 'w');
echo stream_copy_to_stream($src, $dest1, 1024) . " bytes copied to first1k.txt
";
echo stream_copy_to_stream($src, $dest2) . " bytes copied to remainder.txt
";
?>
SEE ALSO
copy(3).
PHP Documentation Group STREAM_COPY_TO_STREAM(3)