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
asetmasters(4)							   File Formats 						    asetmasters(4)

NAME
asetmasters, tune.low, tune.med, tune.high, uid_aliases, cklist.low, cklist.med, cklist.high - ASET master files SYNOPSIS
/usr/aset/masters/tune.low /usr/aset/masters/tune.med /usr/aset/masters/tune.high /usr/aset/masters/uid_aliases /usr/aset/masters/cklist.low /usr/aset/masters/cklist.med /usr/aset/masters/cklist.high DESCRIPTION
The /usr/aset/masters directory contains several files used by the Automated Security Enhancement Tool (ASET). /usr/aset is the default operating directory for ASET. An alternative working directory can be specified by the administrators through the aset -d command or the ASETDIR environment variable. See aset(1M). These files are provided by default to meet the need of most environments. The administrators, however, can edit these files to meet their specific needs. The format and usage of these files are described below. All the master files allow comments and blank lines to improve readability. Comment lines must start with a leading "#" character. tune.low These files are used by the tune task (see aset(1M)) to restrict the permission settings for system objects. Each file is tune.med used by ASET at the security level indicated by the suffix. Each entry in the files is of the form: tune.high pathname mode owner group type where pathname is the full pathname mode is the permission setting owner is the owner of the object group is the group of the object type is the type of the object It can be symlink for a symbolic link, directory for a directory, or file for everything else. Regular shell wildcard ("*", "?", ...) characters can be used in the pathname for multiple references. See sh(1). The mode is a five-digit number that represents the permission setting. Note that this setting represents a least restrictive value. If the current setting is already more restrictive than the specified value, ASET does not loosen the permission settings. For example, if mode is 00777, the permission will not be changed, since it is always less restrictive than the current setting. Names must be used for owner and group instead of numeric ID's. ? can be used as a "don't care" character in place of owner, group, and type to prevent ASET from changing the existing values of these parameters. uid_alias This file allows user ID's to be shared by multiple user accounts. Normally, ASET discourages such sharing for accountabil- ity reason and reports user ID's that are shared. The administrators can, however, define permissible sharing by adding entries to the file. Each entry is of the form: uid=alias1=alias2=alias3= ... where uid is the shared user id alias? is the user accounts sharing the user ID For example, if sync and daemon share the user ID 1, the corresponding entry is: 1=sync=daemon cklist.low These files are used by the cklist task (see aset(1M)), and are created the first time the task is run at the low, medium, cklist.med and high levels. When the cklist task is run, it compares the specified directory's contents with the appropriate cklist.high cklist.level file and reports any discrepancies. EXAMPLES
Example 1: Examples of Valid Entries for the tune.low, tune.med, and tune.high Files The following is an example of valid entries for the tune.low, tune.med, and tune.high files: /bin 00777 root staffsymlink /etc 02755 root staffdirectory /dev/sd* 00640 rootoperatorfile SEE ALSO
aset(1M), asetenv(4) ASET Administrator Manual SunOS 5.10 13 Sep 1991 asetmasters(4)
All times are GMT -4. The time now is 11:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy