Sponsored Content
Top Forums Shell Programming and Scripting awk - printing nth field based on parameter Post 302822653 by Jotne on Tuesday 18th of June 2013 03:59:31 AM
Old 06-18-2013
Awk does not use $ in variable
change $POS to POS
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk substitute variable value in nth field

I have a large csv file that looks like this: The 3rd field is a unix time stamp that I want to convert to human readable. I wrote a bash script with this code: IFS=$',' cat $1 | while read ID user DATE text flags read; do echo -e "$ID,$user,$(date -d @$DATE),$text,$flags,$read... (3 Replies)
Discussion started by: stumpyuk
3 Replies

2. Shell Programming and Scripting

how to find the nth field value in delimiter file in unix using awk

Hi All, I wanted to find 200th field value in delimiter file using awk.? awk '{print $200}' inputfile I am getting error message :- awk: The field 200 must be in the range 0 to 199. The source line number is 1. The error context is {print >>> $200 <<< } using... (4 Replies)
Discussion started by: Jairaj
4 Replies

3. Shell Programming and Scripting

How to Print from nth field to mth fields using awk

Hi, Is there any short method to print from a particular field till another filed using awk? Example File: File1 ==== 1|2|acv|vbc|......|100|342 2|3|afg|nhj|.......|100|346 Expected output: File2 ==== acv|vbc|.....|100 afg|nhj|.....|100 (8 Replies)
Discussion started by: machomaddy
8 Replies

4. Shell Programming and Scripting

Awk product of nth field

How do I do the product of nth filed just like sum. For sum I know like awk '{ sum += $12 } END {printf "%.2f\n", sum}' works as initial sum = 0. But for product how do initialize the variable to 1? (2 Replies)
Discussion started by: madhavb
2 Replies

5. Shell Programming and Scripting

Replace a value of Nth field of nth row

Using Awk, how can I achieve the following? I have set of record numbers, for which, I have to replace the nth field with some values, say spaces. Eg: Set of Records : 4,9,10,55,89,etc I have to change the 8th field of all the above set of records to spaces (10 spaces). Its a delimited... (1 Reply)
Discussion started by: deepakwins
1 Replies

6. Shell Programming and Scripting

awk to update value in field based on another field

In the tab-delimeted input file below I am trying to use awk to update the value in $2 if TYPE=ins in bold, by adding the value of HRUN= in italics. In the below since in line 1 TYPE=ins the 117282541 value in $2 has 6 added because that is the value of HRUN=. Hopefully the awk is a start but I... (2 Replies)
Discussion started by: cmccabe
2 Replies

7. Shell Programming and Scripting

awk to adjust coordinates in field based on sequential numbers in another field

I am trying to output a tab-delimited result that uses the data from a tab-delimited file to combine and subtract specific lines. If $4 matches in each line then the first matching sequential $6 value is added to $2, unless the value is 1, then the original $2 is used (like in the case of line... (3 Replies)
Discussion started by: cmccabe
3 Replies

8. UNIX for Beginners Questions & Answers

Print lines based upon unique values in Nth field

For some reason I am having difficulty performing what should be a fairly easy task. I would like to print lines of a file that have a unique value in the first field. For example, I have a large data-set with the following excerpt: PS003,001 MZMWR/ L-DWD// * PS003,001... (4 Replies)
Discussion started by: jvoot
4 Replies

9. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies

10. UNIX for Beginners Questions & Answers

Problem with getting awk to multiply a field by a value set based on condition of another field

Hi, So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies
XkbAllocServerMap(3)						   XKB FUNCTIONS					      XkbAllocServerMap(3)

NAME
XkbAllocServerMap - Allocate and initialize an empty server map description record SYNOPSIS
Status XkbAllocServerMap (XkbDescPtr xkb, unsigned int which, unsigned int count_acts); ARGUMENTS
- xkb keyboard description in which to allocate server map - which mask selecting map components to allocate - count_acts value of num_acts field in map to be allocated DESCRIPTION
XkbAllocServerMap allocates and initializes an empty server map in the server field of the keyboard description specified by xkb. The which parameter specifies the particular components of the server map structure to allocate, as specified in Table 1. Table 1 XkbAllocServerMap Masks --------------------------------------------------------------------- Mask Effect --------------------------------------------------------------------- XkbExplicitComponentsMask The min_key_code and max_key_code fields of the xkb parameter are used to allo- cate the explicit field of the server map. XkbKeyActionsMask The min_key_code and max_key_code fields of the xkb parameter are used to allo- cate the key_acts field of the server map. The count_acts parameter is used to allocate the acts field of the server map. XkbKeyBehaviorsMask The min_key_code and max_key_code fields of the xkb parameter are used to allo- cate the behaviors field of the server map. XkbVirtualModMapMask The min_key_code and max_key_code fields of the xkb parameter are used to allo- cate the vmodmap field of the server map. If the server map of the keyboard description is not NULL and any fields are already allocated in the server map, XkbAllocServerMap does not overwrite the existing values. The only exception is with the acts array. If the count_acts parameter is greater than the current num_acts field of the server map, XkbAllocServerMap resizes the acts array and resets the num_acts field accordingly. If XkbAllocServerMap is successful, it returns Success. Otherwise, it can return either BadMatch or BadAlloc errors. DIAGNOSTICS
BadAlloc Unable to allocate storage BadMatch A compatible version of Xkb was not available in the server or an argument has correct type and range, but is otherwise invalid BadValue An argument is out of range NOTES
The min_key_code and max_key_code fields of the xkb parameter must be legal values. If they are not valid, XkbAllocServerMap returns Bad- Value. X Version 11 libX11 1.3.2 XkbAllocServerMap(3)
All times are GMT -4. The time now is 03:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy