Sponsored Content
Top Forums Shell Programming and Scripting Finding minimum maximum and average Post 302743991 by joeyg on Thursday 13th of December 2012 03:45:01 PM
Old 12-13-2012
Don't have time to think through it all, but...

The following strips out the [ and ] characters. There are most assuredly other ways also.

Code:
$ cat sample32.txt
Received message from [https://www.demandmatrix.net/app/dm/xml] in [939] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [981] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [447] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [93] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [123] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [124] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [89] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [124] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [103] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [167] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [179] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [2498] milliseconds.
Received message from [https://www.demandmatrix.net/app/dm/xml] in [2505] milliseconds.

$ tr -d '[\[\]]' <sample32.txt | awk -F" " '{print $6}'
939
981
447
93
123
124
89
124
103
167
179
2498
2505

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding minimum value

Hi All, I have multiple files which contains 5 columns and multiple rows..... I want to calculate the minimum value of column 5th, if column 2 is MET, till column 1 comes to the next number. Also it must skip the condition similar to 1st line where column number 1 and 3 are same and... (9 Replies)
Discussion started by: CAch
9 Replies

2. Homework & Coursework Questions

Find the Maximum value and average of a column

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to complete a script which will allow me to find: a) reads a value from the keyboard. (ask the... (4 Replies)
Discussion started by: dstewie
4 Replies

3. Shell Programming and Scripting

minimum and maximum from columns

Hi Friends, my input file is this way chr1 100 120 abc chr1 100 121 def chr1 100 122 ghi chr2 240 263 kil chr2 240 276 ghj chr2 255 290 hjh my output chr1 100 122 abc chr2 240 276 kil chr2 255 290 hjh Basically, I want to match on first and second column and then print the... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

4. Shell Programming and Scripting

Print minimum and maximum values using awk

Can I print the minimum and maximum values of values in first 4 columns ? input 3038669 3038743 3037800 3038400 m101c 3218627 3218709 3217600 3219800 m290 ............. output 3037800 3038743 m101c 3217600 3219800 m290 (2 Replies)
Discussion started by: quincyjones
2 Replies

5. Shell Programming and Scripting

Getting average ,maximum and minimum value

Hi Evreyone below is the sample data i have in one file Wed Jan 30 7 :04:50 2013 type1 419990050 101 ms Wed Jan 30 7 :04:58 2013 type1 488226363 101 ms Wed Jan 30 7 :05:03 2013 type1 431525334 101 ms Wed Jan 30 7 :05:48 2013 type2 400676615 101 ms Wed Jan 30 8 :09:46... (3 Replies)
Discussion started by: zozoo
3 Replies

6. Shell Programming and Scripting

Extract minimum/maximum using awk

From the below table I want to print highest value and lowest value using awk script. aaa 55 66 96 77 ggg 22 96 77 23 ddd 74 58 18 3 kkk 45 89 47 92 zzz 34 58 89 92 Thanks, Green edit by bakunin: it sure is not news to you that you should use CODE-tags, no? And that we do not want such... (3 Replies)
Discussion started by: gwgreen1
3 Replies

7. UNIX and Linux Applications

Maximum and minimum threshold in autosys

Good evening In a production system there are houndred of Jobs running and i´ve got to monitor all of them, but the problem arises when a job running takes much longer or conversely takes nothing and as operator is almost imposible to detect the máximum or mínimum threshold for a running job. Ive... (1 Reply)
Discussion started by: alexcol
1 Replies

8. Shell Programming and Scripting

Output minimum and maximum values for replicates ID

Hi All I hope that someone could help me! I have an input file like this, with 4 colum(ID, feature1, start, end): a x 1 5 b x 3 10 b x 4 9 b x 5 16 c x 5 9 c x 4 8 And my output file should be like this: a x 1 5 b x 3 16 c x 4 9 What I would like to do is to output for each ID... (2 Replies)
Discussion started by: giuliangiuseppe
2 Replies

9. Shell Programming and Scripting

Find minimum and maximum values based on column with associative array

Hello, I need to find out the minimum and maximum values based on specific column, and then print out the entire row with the max value. Infile.txt: scf6 290173 290416 . + X_047241 T_00113118-1 scf6 290491 290957 . + X_047241 T_00113118-2 scf6 290898 290957 . + X_047241 T_00113119-3 scf6... (2 Replies)
Discussion started by: yifangt
2 Replies

10. UNIX for Beginners Questions & Answers

Create a list from minimum and maximum

Using the input file for each row , using columns 1 (min) and 2 (max) , and with increment of 4 each time I want to create the output file. Input file 1000 1012 2000 2001 2000 2008 3000 3001 Output desired 1000 2000 2001 1004 2000 2001 1008 2000 2001 1012 2000 2001 2000 3000 3001... (5 Replies)
Discussion started by: jiam912
5 Replies
Data::StreamSerializer(3pm)				User Contributed Perl Documentation			       Data::StreamSerializer(3pm)

NAME
Data::StreamSerializer - non-blocking serializer. SYNOPSIS
use Data::StreamSerializer; my $sr = new Data::StreamSerializer('You data'); while(defined(my $part = $sr->next)) { print $socket $part; } DESCRIPTION
Sometimes You need to serialize a lot of data. If You use 'Dumper' it can take You for much time. If Your code is executed in event machine it can be inadmissible. So using the module You can serialize Your data progressively and do something between serialization itearions. This module works slower than Data::Dumper, but it can serialize object progressively and You can do something else between serialization iterations. Recognized types. HASH ARRAY REF Regexp SCALAR METHODS
new Constructor. All arguments will be serialized. next Returns next part of serialized string or undef if all data were serialized. block_size Block size for one iteration. Too small value allows You to spend less time for each iteration, but in this case total serialization time will grow. Nod bad choice to set the value between 200 - 2000 bytes (default value is 512). See BENCHMARKS to make a decision. recursion_depth If serialized object has recursive references, they will be replaced by empty objects. But if this value is higher than 1 recursion will be reserialized until the value is reached. Example: my $t = { a => 'b' }; $t->{c} = $t; This example will be serialized into string: {"c",{"c",{},"a","b"},"a","b"} and if You increment recursion_depth, this example will be serialized into string: {"c",{"c",{"c",{},"a","b"},"a","b"},"a","b"} etc. recursion_detected Returns TRUE if a recursion was detected. is_eof Returns TRUE if eof is reached. If it is TRUE the following next will return undef. SEE ALSO
Data::StreamDeserializer. BENCHMARKS
You can try a few scripts in benchmark/ directory. There are a few test arrays in this directory. Here are a few test results of my system. Array which contains 100 hashes: $ perl benchmark/vs_dumper.pl -n 1000 -b 512 benchmark/tests/01_100x10 38296 bytes were read First serializing by eval... done First serializing by Data::StreamSerializer... done Starting 1000 iterations for Dumper... done (40.376 seconds) Starting 1000 iterations for Data::StreamSerializer... done (137.960 seconds) Dumper statistic: 1000 iterations were done maximum serialization time: 0.0867 seconds minimum serialization time: 0.0396 seconds average serialization time: 0.0404 seconds Data::StreamSerializer statistic: 1000 iterations were done 58000 SUBiterations were done maximum serialization time: 0.1585 seconds minimum serialization time: 0.1356 seconds average serialization time: 0.1380 seconds average subiteration time: 0.00238 seconds Array which contains 1000 hashes: $ perl benchmark/vs_dumper.pl -n 1000 -b 512 benchmark/tests/02_1000x10 355623 bytes were read First serializing by eval... done First serializing by Data::StreamSerializer... done Starting 1000 iterations for Dumper... done (405.334 seconds) Starting 1000 iterations for Data::StreamSerializer... done (1407.899 seconds) Dumper statistic: 1000 iterations were done maximum serialization time: 0.4564 seconds minimum serialization time: 0.4018 seconds average serialization time: 0.4053 seconds Data::StreamSerializer statistic: 1000 iterations were done 520000 SUBiterations were done maximum serialization time: 2.0050 seconds minimum serialization time: 1.3862 seconds average serialization time: 1.4079 seconds average subiteration time: 0.00271 seconds You can see that in any cases one iteration gets the same time. AUTHOR
Dmitry E. Oboukhov, <unera@debian.org> COPYRIGHT AND LICENSE
Copyright (C) 2011 by Dmitry E. Oboukhov This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available. VCS
The project is placed in my git repo. See here: http://git.uvw.ru/?p=data-stream-serializer;a=summary <http://git.uvw.ru/?p=data-stream- serializer;a=summary> perl v5.14.2 2011-02-14 Data::StreamSerializer(3pm)
All times are GMT -4. The time now is 11:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy