How to insert gaussian noise to a data with an order with awk?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to insert gaussian noise to a data with an order with awk?
# 1  
Old 07-13-2012
How to insert gaussian noise to a data with an order with awk?

Hello everybody,

My problem is inserting gaussian noise to a file containing data, that is, add every single noise to the number after every 6 character.

here is my data

Code:
0910 1 2048 32.38 40 20.88  28 35.53  9.62  0.00
MSDMP0 1.790MSDMS1 2.840KCTXP2 4.400KRCMP0 4.600BOZMP0 5.640BOZMS2 9.350
ARMTP2 6.540ARMTS211.520FRR6P0 8.170FRR6S013.920CINRP0 8.770FRR7P0 8.450
FRR7S015.250TRNMP012.970CEKMP016.000ATIMP216.160KRBGP319.340     0 0.000
     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000
0910 1 2328 55.48 40 40.72  29 13.24  8.31  0.00
KLCMP0 3.430KLCMS1 6.000SAKIP0 3.820SAKIS1 6.340ARCEP0 4.140ARCES1 6.840
GBZMP0 4.430GBZMS2 7.540IBBTP0 4.590IBBTS2 7.790BUYMP0 4.610BUYMS2 7.680
GOZTP0 4.860GOZTS2 8.140CINRP0 4.000KRMLP0 5.110KRMLS0 8.020SABAP0 5.290
SABAS2 8.950ESKMP0 5.220ESKMS2 9.040GEMTP2 5.220MOLLP0 6.140MOLLS0 9.680
KURNP0 6.140KURNS210.270FRONP0 5.770ARMTP2 6.320ARMTS210.820CEKMP0 7.320
CEKMS012.720FRR7P0 7.160BOZMP0 7.680BOZMS313.180ISK P2 7.320ISK S212.720
IGDMP0 8.570IGDMS214.410MDNYP2 8.360ADVTP2 8.840FRR6P010.680FRR6S018.000
SILTP210.020KLYTP211.180MSDMP011.360MSDMS219.970BGKTP210.790ELBAP014.820
CTKSP313.910KCTXP315.860KRCMP115.720SNLMP118.520SNLMS232.140SLVTP317.020
TRNMP121.250GONEP324.790KRBGP326.340RKY P327.110LAP P332.180     0 0.000
     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000
0910 2 20 9 50.48 40 34.52  28 54.61 14.09  0.00
ARMTP2 2.140ARMTS2 4.220ESKMP0 2.680ESKMS1 4.400CINRP0 3.180BOZMP0 3.500
BOZMS2 5.570MDNYP2 5.180FRR7P0 4.790FRR7S0 8.640GEMTP2 5.790FRONP0 6.000
FRR6P0 6.610BUYMP0 7.070BUYMS211.790MSDMP0 7.250MSDMS212.140IBBTP0 8.500
IBBTS214.860KLCMP0 7.860IGDMP0 8.220IGDMS213.680SABAP0 9.640SABAS216.520
KURNP010.000KURNS216.820ISK P3 8.820KCTXP310.250KRCMP010.790KRCMS219.360
MOLLP010.640KLYTP311.900TRNMP016.570     0 0.000     0 0.000     0 0.000
     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000

and the noise data is

Code:
           1    1.404917E-02 
           2    2.856185E-02 
           3   -1.573673E-02 
           4   -9.390447E-02 
           5   -3.114132E-02 
           6    2.820937E-02 
           7    7.059034E-02 
           8    6.161840E-02 
           9    1.271421E-01 
          10    1.261867E-01 
          11    7.209031E-02 
          12    1.099889E-01 
          13    1.263713E-01 
          14    1.184694E-01 
          15    1.033267E-01 
          16   -7.420211E-03 
          17   -6.541918E-02 
          18    2.441870E-03 
          19   -1.888426E-02 
          20    1.683047E-02 
          21    3.825637E-02 
          22    8.983714E-03 
          23   -2.960162E-03 
          24    6.582643E-02 
          25    7.652121E-02 
          26    5.329586E-02 
          27    8.778058E-02

I need to add second column which is the noise to the times after every station name (6 character)

for example

MSDMP0 1.79 here the noise for example 7.652121E-02 must be added to 1.79

And it should add all the noise to all the stations. I made similar work before but this time could not find a solution.

Pleaseee help me....... Smilie

---------- Post updated at 08:48 AM ---------- Previous update was at 04:47 AM ----------

There must be someone who could give me a tip at least Smilie
# 2  
Old 07-13-2012
please specify clearly what you want why you have chosen 7.652121E-02 value to add or every time you will use this value
# 3  
Old 07-13-2012
Quote:
Originally Posted by raj_saini20
please specify clearly what you want why you have chosen 7.652121E-02 value to add or every time you will use this value
No, it is just an example I want the noise to be added in the same order in the noise file to every number after 6 characters.

I have 11000 number (which are written in the input file) and also I have 11000 noise number to be added to the numbers in the input file. So every number in the noise file will be added to every number after 6 characters.
I hope I am clear
# 4  
Old 07-13-2012
Could you post a sample of desired output. Also could you post what you tried so far?
# 5  
Old 07-13-2012
how you are finding which 6 char will have what noise number
# 6  
Old 07-23-2012
Hello sorry for being late, my aim is to add the noise numbers to the times which are printed after characters likeMSDMP0... With the same order as printed in the second file. For example the first number in the noise file is

1.404917E-02.

This number should be added to the first number in the first file which is in this case, "number that will be summed"

MSDMP0 "1.790"

And the second noise number (2.856185E-02) should be added to

MSDMS1 "2.840"

The output should be the same but with different updated numbers

like,
Code:
0910 1 2048 32.38 40 20.88  28 35.53  9.62  0.00 
MSDMP0 1.804MSDMS1 2.868KCTXP2 4.384KRCMP0 4.506BOZMP0 5.608BOZMS2 9.378

If somone could help???
# 7  
Old 07-23-2012
And what happens on the next line?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Order of data in Spool File

Hello, I have a shell script through which I am executing .sql file and spooling the result of Query from .sql . I want to spool the result in ascending order. Is there any parameter to be set to print result in ascending or descending order. Thanks in advance. (4 Replies)
Discussion started by: Aparna.N
4 Replies

2. Shell Programming and Scripting

How order a data matrix using awk?

is it possible to order the following row clusters from ascending to descending. thanx in advance input 1 2 4 0 1 2 4 0 3 3 3 3 1 5 1 0 1 5 1 0 6 0 0 0 5 1 1 1... (4 Replies)
Discussion started by: quincyjones
4 Replies

3. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

4. Shell Programming and Scripting

how to extract data from numbered files using linux in the numerical order-

Hi experts, I have a list of files containing forces as the only number as follows. Force1.txt Force2.txt Force3.txt Force4.txt Force5.txt . . . . . . . . . Force100.txt I want to put all the data(only a number ) in these forces files in the file with the same order like 1,2,3 ..100 .... (2 Replies)
Discussion started by: hamnsan
2 Replies

5. Shell Programming and Scripting

Help with sort data based on descending order problem

Input file 9.99331e-13 8.98451e-65 9.98418e-34 7.98319e-08 365592 111669 74942.9 0 Desired output 365592 111669 74942.9 7.98319e-08 1.99331e-13 6.98418e-34 (2 Replies)
Discussion started by: perl_beginner
2 Replies

6. Shell Programming and Scripting

Generating Gaussian Distributed Random Numbers

I want to generate an awk function that generated a Gaussian distributed set of random numbers. I need to implement the thing below in awk. Rnd is just a uniform random number between 0 and 1 function rgaussian(r1, r2) { Do v1 = 2 * Rnd - 1 v2 = 2 * Rnd - 1 ... (0 Replies)
Discussion started by: kristinu
0 Replies

7. Shell Programming and Scripting

Awk: Data Insert

Hi guys, I'm having some difficulties in insert some details to the following contents. I need to insert "TEST" under MIR & a value "25" to the next line. So far, I am able to insert "TEST" by using awk to capture MIR as the identifier. However, I am having some difficulties in inserting "25"... (3 Replies)
Discussion started by: nantheless
3 Replies

8. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

9. Solaris

Not able to insert data

Hi All, I enhanced a perl script that creates a table with xyz_yyyymm and insert data from xyz table before truncate xyz.I have tested it successfully in dev but when i ran it on production new table xyz_yyyymm created but did not insert any records from xyz.(No errors were thrown)The perl... (1 Reply)
Discussion started by: megh
1 Replies

10. Shell Programming and Scripting

AWK - printing certain fields when field order changes in data file

I'm hoping someone can help me on this. I have a data file that greatly simplified might look like this: sec;src;dst;proto 421;10.10.10.1;10.10.10.2;tcp 426;10.10.10.3;10.10.10.4;udp 442;10.10.10.5;10.10.10.6;tcp sec;src;fac;dst;proto 521;10.10.10.1;ab;10.10.10.2;tcp... (3 Replies)
Discussion started by: eric4
3 Replies
Login or Register to Ask a Question