Sponsored Content
Full Discussion: Data imputation with scaling
Top Forums Shell Programming and Scripting Data imputation with scaling Post 302932365 by RudiC on Wednesday 21st of January 2015 06:10:18 AM
Old 01-21-2015
Might be even more cryptic than MadeInGermany's, and certainly need some polishing/elegance, but try:
Code:
awk     'NR==FNR        {s[$1]=$2; if (L) DX[$1]=$2-L; L=$2; next}
         ($1 in s)      {if (K) D2=$2-K; K=$2; D1=DX[$1]
                         if (D1) for (i=C; i< NR; i++) print NM[i], s[$1]+D1*(VL[i]-K)/D2
                         print $1, s[$1];
                         C=NR+1
                         delete s[$1]
                        }
                        {NM[NR]=$1; VL[NR]=$2
                        }
         END            {for (i in s) print i, s[i]}
        ' OFMT="%.2f" file1 file2
a1 10
b12 11.19
c12 12.38
d12 14.76
a2 15
b23 17.32
a3 20
a4 21

This User Gave Thanks to RudiC For This Post:
 

We Also Found This Discussion For You

1. Shell Programming and Scripting

Re-scaling values - perl

Hey folks I have a big tab delimited file with 3 columns looks like this: chr2L 552 0.85 chr2R 135 1.06 chr3L 820 2.89 chr3R 581 3.93 chr4 585 0.94 chrX 605 1.93 All I want to do is re-scaling the third column to be between 0-1. Which means that the highest valu in 3rd column will... (5 Replies)
Discussion started by: @man
5 Replies
EXIM_CONVERT4R4(8)					      System Manager's Manual						EXIM_CONVERT4R4(8)

NAME
exim_convert4r4 - Convert Exim configuration from v3 to v4 format SYNOPSIS
exim_convert4r4 DESCRIPTION
This script is provided to assist in updating Exim configuration files. It reads an Exim 3 configuration file on the standard input, and writes a modified file on the standard output. It also writes comments about what it has done to the standard error file. It assumes that the input is a valid Exim 3 configuration file. A typical call to the conversion script might be exim_convert4r4 < /etc/exim/exim.conf > /etc/exim4/exim4.conf.new The output file MUST be checked and tested before trying to use it on a live system. The conversion script is just an aid which does a lot of the "grunt work". It does not guarantee to produce an Exim 4 configuration that behaves exactly the same as the Exim 3 configuration it reads. Each option change in the new file is preceded by an identifying comment. In fact, the conversion script tends to make quite a mess of your configuration, and you should expect to go through it afterwards and tidy it up by hand. Unless you are running a very straightforward configuration, the automatic conversion is likely to generate a non-optimal configuration. You should not only check it thoroughly, but also run as many tests as you can, to ensure that it is working as you expect. In particular, you should test address routing, using -bt and -bv, and the policy controls, using -bh. If possible, you should also do some live tests (i.e. send and receive some messages) before putting Exim 4 into service. If you have a very complicated configuration, it is possible that exim_convert4r4 will break it in some situations, which is why thorough testing is strongly recommended. BUGS
This manual page needs a major re-work. If somebody knows better groff than us and has more experience in writing manual pages, any patches would be greatly appreciated. SEE ALSO
exim(8), the files in /usr/share/doc/exim4-base/, especially Exim4.upgrade.gz AUTHOR
This manual page was stitched together from Exim4.upgrade by Andreas Metzler <ametzler at downhill.at.eu.org>, for the Debian GNU/Linux system (but may be used by others). March 26, 2003 EXIM_CONVERT4R4(8)
All times are GMT -4. The time now is 11:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy