03-14-2008
another issue comes out here. As the patter keeps change, I want to put it into a variable and reference the variable in a regular expression. Like below:
key="bin.*rundb"
if (fieldname ~ /key/) {
printf("%s\n", fieldname);
}
I tried "'$key'", '"$key" and $key in the regular expression, but all won't work. Do you know how can i accomplish it?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi guys,
insert into /*<new>*/abc_db.tbl_name
this is should be replaced to
insert into /*<new>*/${new}.tbl_name
it should use '.' as delimiter and replace
is there any way to do it using sed (6 Replies)
Discussion started by: sol_nov
6 Replies
2. Shell Programming and Scripting
Hi,
I know how to use awk to search some expressions like five consecutive numbers, , this is easy.
However, how do I make awk print the pattern that is been matched?
For example:
input: usa,canada99292,japan222,france59664,egypt223
output:99292,59664 (6 Replies)
Discussion started by: grossgermany
6 Replies
3. Shell Programming and Scripting
Hello, i am splitting files and sometimes the string of the pattern doesnt exist in the input file it starts for example with 00:00:01. So the output is completely desorganized, is there any way of putting a replacement string in the pattern so it will grab all the times from 00:**:** to first... (0 Replies)
Discussion started by: x-plicit78
0 Replies
4. Shell Programming and Scripting
Hello,
I have two files in the following format;
file1:
A B C D
E F G H
I J K L
file2:
1 2 3 4
5 6 7 8
9 10 11 12
I have read them both in to multi-dimensional arrays. I need a file that has column 2 of the first file printed out for each column 3 of the second file ie...
... (3 Replies)
Discussion started by: cold_Que
3 Replies
5. Shell Programming and Scripting
I am trying to break a string into separate fields and print the field that matches a pattern. I am using awk at the moment and have gotten this far:
awk '{for(i=1;i<=NF;++i)print "\t" $i}' longstring
This breaks the string into fields and prints each field on a separate line.
I want to add... (2 Replies)
Discussion started by: Moxy
2 Replies
6. Shell Programming and Scripting
Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match.
I'm stuck in an AWK... (9 Replies)
Discussion started by: right_coaster
9 Replies
7. Shell Programming and Scripting
Hello,
Please see below line code:
#!/bin/ksh
set -x
/usr/bin/cat /home/temp |while read line
do
if ]
then
echo "matched"
else
echo "nope"
fi
done
content of filr temp is as below (4 Replies)
Discussion started by: skhichi
4 Replies
8. Shell Programming and Scripting
Hello Guyz
I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline
ABC
DEF
LMN
EFG
HIJ
LMN
OPQ
In the above text i need to... (8 Replies)
Discussion started by: RickCharles
8 Replies
9. Shell Programming and Scripting
Hi,
I have long string in 2nd field, as shown below:
REF1 | CLESCLJSCSHSCSMSCSNSCSRSCUDSCUFSCU7SCV1SCWPSCXGPDBACAPA0DHDPDMESED6
REF2 | SBR4PCBFPCDRSCSCG3SCHEBSCKNSCKPSCLLSCMCZXTNPCVFPCV6P4KL0DMDSDSASEWG
I have a group of fixed patterns which can occur in these long strings & only... (11 Replies)
Discussion started by: karumudi7
11 Replies
10. Shell Programming and Scripting
Hi Experts,
I am finding difficulty to get exact match:
file
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
INTERFACE_NAME="lan3"
IP_ADDRESS="10.53.52.241"
SUBNET_MASK="255.255.255.192"
BROADCAST_ADDRESS=""
INTERFACE_STATE=""
DHCP_ENABLE=0
INTERFACE_NAME="lan3:1"... (6 Replies)
Discussion started by: rveri
6 Replies
LEARN ABOUT HPUX
pthread_setspecific
pthread_getspecific(3T) pthread_getspecific(3T)
NAME
pthread_getspecific(), pthread_setspecific() - get or set the thread-specific data associated with a key
SYNOPSIS
PARAMETERS
key Thread-specific data key whose value for the calling thread is to be set or retrieved.
value Value to be assigned to the thread-specific data key for the calling thread.
DESCRIPTION
The function returns the thread-specific data value associated with key for the calling thread. If no value has been associated with key
for the calling thread, NULL is returned.
The function associates the thread-specific data value with key. Each thread may bind a different value to key. These values are usually
pointers to memory dynamically allocated by the calling thread.
key must be a valid thread-specific data key created by calling If key is not a valid thread-specific data key, undefined behavior results
when calling these functions.
These functions may be called from a thread-specific data destructor function. However, calling from a destructor may result in lost stor-
age.
RETURN VALUE
The function returns the thread-specific data value associated with key. If no thread-specific data value is currently associated with
key, the value NULL is returned.
If successful, returns zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
No errors are returned by the function.
If any of the following occur, the function returns the corresponding error number:
[ENOMEM] There is insufficient memory available in which to associate value with key.
For each of the following conditions, if the condition is detected, the function returns the corresponding error number:
[EINVAL] key is an invalid thread-specific data key.
AUTHOR
and were derived from the IEEE POSIX P1003.1c standard.
SEE ALSO
pthread_key_create(3T), pthread_key_delete(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_getspecific(3T)