Sponsored Content
Top Forums UNIX for Beginners Questions & Answers awk Associative Array and/or Referring to Field by String (Nonconstant String Value) Post 303029784 by Scrutinizer on Friday 1st of February 2019 12:13:58 AM
Old 02-01-2019
I wrote some additional approaches in my page. And there was an extra variable (used for debugging) that I now removed in the first example. The is a space between the brackets in the field separator that should not be there in your example:
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with lookup values on AWK associative array

I'm at wits end with this issue and my troubleshooting leads me to believe it is a problem with the file formatting of the array referenced by my script: awk -F, '{if (NR==FNR) {a=$4","$3","$2}\ else {print a "," $0}}' WBTSassignments1.txt RNCalarms.tmp On the WBTSassignments1.txt file... (2 Replies)
Discussion started by: JasonHamm
2 Replies

2. Shell Programming and Scripting

Awk Search text string in field, not all in field.

Hello, I am using awk to match text in a tab separated field and am able to do so when matching the exact word. My problem is that I would like to match any sequence of text in the tab-separated field without having to match it all. Any help will be appreciated. Please see the code below. awk... (3 Replies)
Discussion started by: rocket_dog
3 Replies

3. Shell Programming and Scripting

awk, associative array, compare files

i have a file like this < '393200103052';'H3G';'20081204' < '393200103059';'TIM';'20110111' < '393200103061';'TIM';'20060206' < '393200103064';'OPI';'20110623' > '393200103052';'HKG';'20081204' > '393200103056';'TIM';'20110111' > '393200103088';'TIM';'20060206' Now i have to generate a file... (9 Replies)
Discussion started by: shruthi123
9 Replies

4. Homework & Coursework Questions

passing letters from an array into a string for string comparison

attempting the hangman program. This was an optional assignment from the professor. I have completed the logical coding, debugging now. ##I have an array $wordString that initializes to a string of dashes ##reflecting the number of letters in $theWord ##every time the user enters a (valid)... (5 Replies)
Discussion started by: lotsofideas
5 Replies

5. Shell Programming and Scripting

Help needed on Associative array in awk

Hi All, I got stuck up with shell script where i use awk. The scenario which i am working on is as below. I have a file text.txt with contents COL1 COL2 COL3 COL4 1 A 500 400 1 B 500 400 1 A 500 200 2 A 290 300 2 B 290 280 3 C 100 100 I could able to sum col 3 and col4 based on... (3 Replies)
Discussion started by: imsularif
3 Replies

6. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

7. Shell Programming and Scripting

Split string into map (Associative Array)

Hi Input: { committed = 782958592; init = 805306368; max = 1051394048; used = 63456712; } Result: A map (maybe Associative Array) where I can iterate through the key/value. Something like this: for key in $map do echo key=$key value=$map done Sample output from the map: ... (2 Replies)
Discussion started by: chitech
2 Replies

8. Shell Programming and Scripting

Awk: Dealing with whitespace in associative array indicies

Is there a reliable way to deal with whitespace in array indicies? I am trying to annotate fails in a database using a table of known fails. In a begin block I have code like this: # Read in Known Fail List getline < "'"$failListFile"'"; getline < "'"$failListFile"'"; getline <... (6 Replies)
Discussion started by: Michael Stora
6 Replies

9. UNIX for Beginners Questions & Answers

String has * as the field delimiter and I need echo/awk to escape it, how?

Hi, I am trying to read an Oracle listener log file line by line and need to separate the lines into several fields. The field delimiter for the line happens to be an asterisk. I have the script below to start with but when running it, the echo command is globbing it to include other... (13 Replies)
Discussion started by: newbie_01
13 Replies

10. Shell Programming and Scripting

awk to average field if matching string in another

In the awk below I am trying to get the average of the sum of $7 if the string in $4 matches in the line below it. The --- in the desired out is not needed, it is just to illustrate the calculation. The awk executes and produces the current out. I am not sure why the middle line is skipped and the... (2 Replies)
Discussion started by: cmccabe
2 Replies
XmVaCreateSimplePopupMenu(3X)											     XmVaCreateSimplePopupMenu(3X)

NAME
XmVaCreateSimplePopupMenu - A RowColumn widget convenience creation function SYNOPSIS
#include <Xm/RowColumn.h> Widget XmVaCreateSimplePopupMenu (parent, name, callback, arg...) Widget parent; String name; XtCallbackProc callback; DESCRIPTION
XmVaCreateSimplePopupMenu creates an instance of a RowColumn widget of type XmMENU_POPUP and returns the associated widget ID. This routine uses the ANSI C variable-length argument list (varargs) calling convention. This routine creates a Popup MenuPane and its button children. The name of each button is button_n, where n is an integer from 0 to one minus the number of buttons in the menu. The name of each separator is separator_n, where n is an integer from 0 to one minus the number of separators in the menu. The name of each title is label_n, where n is an integer from 0 to one minus the number of titles in the menu. But- tons, separators, and titles are named and created in the order in which they are specified in the variable portion of the argument list. Specifies the widget ID of the parent of the MenuShell Specifies the name of the created widget Specifies a callback procedure to be called when a button is activated or when its value changes. This callback function is added to each button after creation. For a CascadeButton- Gadget or a PushButtonGadget, the callback is added as the button's XmNactivateCallback, and it is called when the button is activated. For a ToggleButtonGadget, the callback is added as the button's XmNvalueChangedCallback, and it is called when the button's value changes. The button number is returned in the client_data field. The variable portion of the argument list consists of groups of arguments. The first argument in each group is a constant or a string and determines which arguments follow in that group. The last argument in the list must be NULL. Following are the possible first arguments in each group of varargs: This is followed by two additional arguments. The set specifies one button in the PopupMenu and some of its resource values. The button created is a CascadeButtonGadget. Following are the additional two arguments, in this order: The label string, of type XmString. The mnemonic, of type KeySym. This is followed by four additional arguments. The set specifies one button in the PopupMenu and some of its resource values. The button created is a PushButtonGadget. Following are the additional four arguments, in this order: The label string, of type XmString. The mnemonic, of type KeySym. The accelerator, of type String. The accelerator text, of type XmString. This is followed by four additional arguments. The set specifies one button in the PopupMenu and some of its resource val- ues. The button created is a ToggleButtonGadget. Following are the additional four arguments, in this order: The label string, of type XmString. The mnemonic, of type KeySym. The accelerator, of type String. The accelerator text, of type XmString. This is followed by four additional arguments. The set specifies one button in the PopupMenu and some of its resource values. The button created is a Toggle- ButtonGadget. Following are the additional four arguments, in this order: The label string, of type XmString. The mnemonic, of type KeySym. The accelerator, of type String. The accelerator text, of type XmString. This is followed by one additional argument. The pair specifies a title LabelGadget in the PopupMenu. Following is the additional argument: The title string, of type XmString. This is fol- lowed by no additional arguments. It specifies one separator in the PopupMenu. This is followed by no additional arguments. It specifies one separator in the PopupMenu. The separator type is XmDOUBLE_LINE. This is followed by one additional argument, the value of the resource, of type XtArgVal. The pair specifies a resource and its value for the RowColumn widget. This is followed by four additional arguments. The set specifies a resource and its value for the RowColumn widget. A resource type conversion is performed if necessary. Following are the additional four arguments, in this order: The resource name, of type String. The type of the resource value supplied, of type String. The resource value (or a pointer to the resource value, depending on the type and size of the value), of type XtArgVal. The size of the resource value in bytes, of type int. This is followed by one additional argument of type XtVarArgsList. This argument is a nested list of varargs returned by XtVaCreateArgsList. For more information on variable-length argument lists, see the X Toolkit Intrinsics documentation. A number of resources exist specifically for use with this and other simple menu creation routines. For a complete definition of RowColumn and its associated resources, see XmRowColumn(3X). RETURN VALUE
Returns the RowColumn widget ID. SEE ALSO
XmCreatePopupMenu(3X), XmCreateRowColumn(3X), XmCreateSimplePopupMenu(3X), XmRowColumn(3X) XmVaCreateSimplePopupMenu(3X)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy