Sponsored Content
Full Discussion: awk name pair values
Top Forums Shell Programming and Scripting awk name pair values Post 303025821 by vgersh99 on Monday 12th of November 2018 04:32:37 PM
Old 11-12-2018
Code:
awk -F, '                            # use , as input field separator
{ # use array a index by $1 and value of indexed entry is built by
  # concatenating $3 to it separated by the value of OFS (space by default)
  #a[$1]=($1 in a)? a[$1] OFS $3:$3
  # the above can be rewritten as
  if ($1 in a)
     a[$1] = a[$1] OFS $3
  else
     a[$1]=$3
} 
END {
  # iterate through array a indexed by i - outputting a string script followed by
  # OFS (OutFieldSeparator - space by default), followed by value of array entry
  # iterated by i, followed by OFS and followed by the value of current iterator i.
  # iterator is the value of column $1
  for (i in a) 
    print "script" OFS a[i] OFS i
}' myFile

 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

can't pair BT keyboard/mice

hello, i can't pair BT keyboard and mice under OS X leopard 10.5.7 installed on pc hardware using ipc osx86 10.5.6 final dvd. I could not find any answers on the web, nor on the osx86 forums, so i figured out maybe ill try my luck on linux/unix forum, after all from what i know os x is basicly a... (0 Replies)
Discussion started by: baron_harkonnen
0 Replies

2. Shell Programming and Scripting

How to pick values from column based on key values by usin AWK

Dear Guyz:) I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z). I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Discussion started by: repinementer
16 Replies

3. Shell Programming and Scripting

AWK: read values from file1; search for values in file2

I have read another post about this issue and am wondering how to adapt it to my own, much simpler, issue. I have a file of user IDs like so: 333333 321321 546465 ...etc I need to take each number and use it to print records wherein the 5th field matches the user ID pulled from the... (2 Replies)
Discussion started by: Bubnoff
2 Replies

4. Shell Programming and Scripting

How to find the X highest values in a list depending on the values of another list with bash/awk?

Hi everyone, This is an exemple of inpout.txt file (a "," delimited text file which can be open as csv file): ID, Code, Value, Store SP|01, AABBCDE, 15, 3 SP|01, AABBCDE, 14, 2 SP|01, AABBCDF, 13, 2 SP|01, AABBCDE, 16, 3 SP|02, AABBCED, 15, 2 SP|01, AABBCDF, 12, 3 SP|01, AABBCDD,... (1 Reply)
Discussion started by: jeremy589
1 Replies

5. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies

6. Shell Programming and Scripting

How many studies have unequal values for each pair?

I have several Studies (s) which has points (p) having Values (v). My goal is to determine for each pair of points, how many studies have different values ( if available ). Study Point Value 1 p1 value1 1 p2 value2 1 p3 value1 1 p4 value3 1 p5 value3 2 p2 value1 2 p4 value1 3 p1 value1... (5 Replies)
Discussion started by: senhia83
5 Replies
PKCHECK(1)							      pkcheck								PKCHECK(1)

NAME
pkcheck - Check whether a process is authorized SYNOPSIS
pkcheck [--version] [--help] pkcheck [--list-temp] pkcheck [--revoke-temp] pkcheck --action-id action {--process { pid | pid,pid-start-time } | --system-bus-name busname} [--allow-user-interaction] [--enable-internal-agent] [--detail key value...] DESCRIPTION
pkcheck is used to check whether a process, specified by either --process or --system-bus-name, is authorized for action. The --detail option can be used zero or more times to pass details about action. If --allow-user-interaction is passed, pkcheck blocks while waiting for authentication. The invocation pkcheck --list-temp will list all temporary authorizations for the current session and pkcheck --revoke-temp will revoke all temporary authorizations for the current session. This command is a simple wrapper around the PolicyKit D-Bus interface; see the D-Bus interface documentation for details. RETURN VALUE
If the specified process is authorized, pkcheck exits with a return value of 0. If the authorization result contains any details, these are printed on standard output as key/value pairs using environment style reporting, e.g. first the key followed by a an equal sign, then the value followed by a newline. KEY1=VALUE1 KEY2=VALUE2 KEY3=VALUE3 ... Octects that are not in [a-zA-Z0-9_] are escaped using octal codes prefixed with . For example, the UTF-8 string fol, will be printed as f303270l54344275240345245275. If the specificied process is not authorized, pkcheck exits with a return value of 1 and a diagnostic message is printed on standard error. Details are printed on standard output. If the specificied process is not authorized because no suitable authentication agent is available or if the --allow-user-interaction wasn't passed, pkcheck exits with a return value of 2 and a diagnostic message is printed on standard error. Details are printed on standard output. If the specificied process is not authorized because the authentication dialog / request was dismissed by the user, pkcheck exits with a return value of 3 and a diagnostic message is printed on standard error. Details are printed on standard output. If an error occured while checking for authorization, pkcheck exits with a return value of 127 with a diagnostic message printed on standard error. If one or more of the options passed are malformed, pkcheck exits with a return value of 126. If stdin is a tty, then this manual page is also shown. NOTES
Since process identifiers can be recycled, the caller should always use pid,pid-start-time to specify the process to check for authorization when using the --process option. The value of pid-start-time can be determined by consulting e.g. the proc(5) file system depending on the operating system. If only pid is passed to the --process option, then pkcheck will look up the start time itself but note that this may be racy. AUTHENTICATION AGENT
pkcheck, like any other PolicyKit application, will use the authentication agent registered for the process in question. However, if no authentication agent is available, then pkcheck can register its own textual authentication agent if the option --enable-internal-agent is passed. AUTHOR
Written by David Zeuthen davidz@redhat.com with a lot of help from many others. BUGS
Please send bug reports to either the distribution or the polkit-devel mailing list, see the link http://lists.freedesktop.org/mailman/listinfo/polkit-devel on how to subscribe. SEE ALSO
polkit(8), pkaction(1), pkexec(1), pkttyagent(1) polkit May 2009 PKCHECK(1)
All times are GMT -4. The time now is 01:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy