awk arrays - compare value in second column to variable
Hello,
I am trying to redirect files to a directory by using a config file. The config files is as such:
and so on...
I have a variable that should match one of these IDs. I want to load this config file into an awk array, and then parse trhough it to find the record and then use the PathToDirectory to copy my file to it.
This is what I have:
Any thoughts? My idea is to fill the array, and then compare my AK202 variable to the second column, store the third as the destination directory.
Regards!
Last edited by radoulov; 04-09-2012 at 03:53 PM..
Reason: Code tags!
I've been banging my head against the wall to accomplish the following. Given two files:
File a.txt
12345 hello
32324 there
File b.txt
12345 stuff
45454 howdy
32324 joe
If column 1 matches between the two files, then print only the entire line of the 2nd file (b.txt in this... (3 Replies)
Hi
have an array like this
colarray="a"
colarray="b"
colarray="c"
colarray="d"
colarray="e"
colarray="f"
the arrayvariable is in unix sh file
i want to check the content of the array to oracle database table.
that is whether "a" is present in the table. (4 Replies)
Hi to everyone,
Please some help over here.
Hi have array a with 6 elements and array b with 3 elements as shown inside BEGIN{} statement.
I need help to get the correct sintax (the part in red) to compare if string from array b is in array a and print the number
related for each match.... (3 Replies)
Hi,
I have a table in unix from which i want to read the contents line by line, then filter out the values from 6th column one by one and compare it a fixed value.
How to do this? (7 Replies)
Hi,
I know that this topic has been discussed in the past and I've tried to follow all the guidelines. Anyhow, I following describe my problem.
I have a file (file1 , no. records = 67) containing pairs of IP addresses as follows (with single space as delimiter between the fields):
example... (5 Replies)
Hi All,
I have a file test.txt.
Content of test.txt :
1 vinay se
2 kumar sse
4 kishore tl
I am extracting the content of file with below command.
awk '$2 ~ "vinay" {print $0}' test.txt
Now instead of hardcoding $2 is there any way pass $2 as variable and compare with a... (7 Replies)
I need your help to discover missing elements for each box.
In theory each box should have 4 items: ITEM01, ITEM02, ITEM08, and ITEM10.
Some boxes either have a missing item (BOX02 ITEM08) or might have da duplicate item (BOX03 ITEM02) and missing another one (BOX03 ITEM01).
file01.txt
... (2 Replies)
Hi team,
I have below sample file. It has 4 columns. I want awk script to compare column2 and column4 row by row and print result in new column5
If value matches then result should be MATCHED
if not then result should be NOT MATCHED
Input file as below
UDC_MSISDN,UDC_NPREFIX... (9 Replies)
Example:
I have files in below format
file 1:
zxc,133,joe@example.com
cst,222,xyz@example1.com
File 2 Contains:
hxd
hcd
jws
zxc
cst
File 1 has 50000 lines and file 2 has around 30000 lines :
Expected Output has to be :
hxd
hcd
jws (5 Replies)
i'm new to awk, and i've been searching on the forum for sum of a column but all the scripts does sum a column of an entire file.
I've a file like this:
cat file.txt
1234 5678
5678 1234
I want to use awk to do sum of each column per line not entire file, compare the two then write the... (1 Reply)
Discussion started by: chofred
1 Replies
LEARN ABOUT OPENSOLARIS
scrollkeeper-config
scrollkeeper-config(1) User Commands scrollkeeper-config(1)NAME
scrollkeeper-config - helper script for building with scrollkeeper
SYNOPSIS
scrollkeeper-config [--help] [--version] [--prefix=dir] [--localstatedir] [--pkglocalstatedir] [--pkgdatadir] [--omfdir]
DESCRIPTION
The scrollkeeper-config tool is used to determine the compiler and linker flags that should be used to compile and link programs that use
the scrollkeeper library.
OPTIONS
The following options are supported:
--help Print a usage summary.
--localstatedir Outputs the localstatedir used to install scrollkeeper.
--omfdir Directory where scrollkeeper searches for OMF files.
--pkgdatadir Outputs the directory under datadir where scrollkeeper keeps its non-variable (that is, non-database) files.
--pkglocalstatedir Outputs the directory under localstatedir where scrollkeeper keeps its database.
--prefix=dir If specified, use dir instead of the installation prefix that the library was built with.
--version Print the currently installed version of the library on the standard output.
EXAMPLES
Example 1: Getting the scrollkeeper library version
example% scrollkeeper-config --version
EXIT STATUS
The following exit values are returned:
0 Application exited successfully
>0 Application exited with failure
FILES
The following files are used by this application:
/usr/bin/scrollkeeper-config Executable for the scrollkeeper helper script
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWgnome-libs |
+-----------------------------+-----------------------------+
|Interface stability |Obsolete |
+-----------------------------+-----------------------------+
SEE ALSO pkg-config(1), scrollkeeper(1)NOTES
This man page was originally written by Chris Waters (xtifr@debian.org) for Debian GNU/Linux. Rewritten by Brian Cameron, Sun Microsystems
Inc., using information from the orbit2-config(1) man page, by Dick Porter (dick@acm.org) and Elliot Lee (sopwith@redhat.com). scroll-
keeper--specific text was written by Laszlo Kovacs (laszlo.kovacs@sun.com) and Dan Mueth (d-mueth@uchicago.edu).
Updated by Ghee Teo, Sun Microsystems Inc., 2007
SunOS 5.11 11 Jan 2003 scrollkeeper-config(1)