05-13-2014
i in $i is undefined because you incorrectly initialize it to itself.
Regards,
Alister
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All..I need a help i am trying to find a word using below script whereas the word exists in my file nitin.txt as a directory but still i am getting "word not found" output..Your suggestions welcomed.:
#to check for existence of nitin
#!/bin/bash
cd /apps/uat1/deploy/app
ls -lrt >... (4 Replies)
Discussion started by: nattynitin
4 Replies
2. UNIX for Advanced & Expert Users
Hi,
Putting across a few awk expressions.
Apart from the last, all of them are working.
echo a/b/c | awk -F'/b/c$' '{print $1}'
a
echo a/b/c++ | awk -F'/b/c++' '{print $1}'
a
echo a/b/c++ | awk -F'/b/c++$' '{print $1}'
a/b/c++
Request thoughts on why putting a '$' post double ++... (12 Replies)
Discussion started by: vibhor_agarwali
12 Replies
3. Shell Programming and Scripting
Hi
I am writing a script using nano and I'm asking the user for their full name, I then store this in a variable but I only want to display the last word that they input. Any idea on how I would do this using awk. I am not using sed, just using a script. So far I have got this...
echo "What... (1 Reply)
Discussion started by: Addman1991
1 Replies
4. UNIX for Dummies Questions & Answers
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies
5. Shell Programming and Scripting
Hello, everyone.
I am having trouble figuring out sed command which emulates uniq. The task I want to do is that 2 consecutive lines in file should be considered the same using the first word only. Example:
cat tmp.txt
ddd eee
aaa bbb ccc
ddd eee fff
asd fdd
asd fdd bbb
aaa bbb
asd fgh... (4 Replies)
Discussion started by: motorcek
4 Replies
6. Shell Programming and Scripting
Hi,
i have a file that contains the following:
ARTPRD01_app =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11.222.3.4)(PORT = 1540))
(CONNECT_DATA =
(SERVICE_NAME = artprd01.com)
ARTPRD01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11.223.3.1)(PORT =... (2 Replies)
Discussion started by: reignangel2003
2 Replies
7. Shell Programming and Scripting
Hi,
I have around 10 files in a folder in which I want to change the file format from tab(\t) to pipe(|) with some changes in the fields as well. Below is the code, while tmp file is getting generated but move command is not working, please help
Following is the code
awk -F"\t" '{print... (2 Replies)
Discussion started by: siramitsharma
2 Replies
8. Shell Programming and Scripting
Hi,
I am trying below code but the word boundaries not seem to be working. What am I doing incorrectly?
echo " ECHO " | awk '{ q="ECHO" ; if ( $0 ~ /\bq\b/) print "HELLO" ; }'
OR
echo " ECHO " | awk '{ q="ECHO" ; if ( $0 ~ /\b'$q'\b/) print "HELLO" ; }'
Or
echo " ECHO " | awk... (6 Replies)
Discussion started by: ahmedwaseem2000
6 Replies
9. Shell Programming and Scripting
echo {mbr_key,grp_key,dep_key,abc,xyz,aaa,ccc} |
awk 'gsub(/^|abc,|$/,"") {print}'
Required output
{grp_key,xyz,aaa,ccc} (5 Replies)
Discussion started by: 100bees
5 Replies
10. UNIX for Beginners Questions & Answers
I have a multicolumn text file with header in the first row like this
The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach
for ii in ${hdr}
do
gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies
LEARN ABOUT OPENSOLARIS
pthread_mutex_destroy
pthread_mutex_init(3C) Standard C Library Functions pthread_mutex_init(3C)
NAME
pthread_mutex_init, pthread_mutex_destroy - initialize or destroy a mutex
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include <pthread.h>
int pthread_mutex_init(pthread_mutex_t *restrict mutex,
const pthread_mutexattr_t *restrict attr);
int pthread_mutex_destroy(pthread_mutex_t *mutex);
pthread_mutex_t mutex= PTHREAD_MUTEX_INITIALIZER;
DESCRIPTION
The pthread_mutex_init() function initializes the mutex referenced by mutex with attributes specified by attr. If attr is NULL, the
default mutex attributes are used; the effect is the same as passing the address of a default mutex attributes object. Upon successful ini-
tialization, the state of the mutex becomes initialized and unlocked.
Except for robust mutexes, attempting to initialize an already initialized mutex results in undefined behavior.
The pthread_mutex_destroy() function destroys the mutex object referenced by mutex; the mutex object becomes, in effect, uninitialized. A
destroyed mutex object can be re-initialized using pthread_mutex_init(); the results of otherwise referencing the object after it has been
destroyed are undefined.
It is safe to destroy an initialized mutex that is unlocked. Attempting to destroy a locked mutex results in undefined behavior.
In cases where default mutex attributes are appropriate, the macro PTHREAD_MUTEX_INITIALIZER can be used to initialize mutexes that are
statically allocated. The effect is equivalent to dynamic initialization by a call to pthread_mutex_init() with parameter attr specified as
NULL, except that no error checks are performed.
RETURN VALUES
If successful, the pthread_mutex_init() and pthread_mutex_destroy() functions return 0. Otherwise, an error number is returned to indicate
the error.
ERRORS
The pthread_mutex_init() function will fail if:
EAGAIN The system lacked the necessary resources (other than memory) to initialize another mutex.
EBUSY An attempt was detected to re-initialize a robust mutex previously initialized but not yet destroyed. See pthread_mutex-
attr_setrobust(3C).
EINVAL An attempt was detected to re-initialize a robust mutex previously initialized with a different set of attributes. See
pthread_mutexattr_setrobust(3C).
ENOMEM Insufficient memory exists to initialize the mutex.
EPERM The caller does not have the privilege to perform the operation.
The pthread_mutex_init() function may fail if:
EBUSY An attempt was detected to re-initialize the object referenced by mutex, a mutex previously initialized but not yet destroyed.
EINVAL The value specified by attr or mutex is invalid.
The pthread_mutex_destroy() function may fail if:
EBUSY An attempt was detected to destroy the object referenced by mutex while it is locked or referenced (for example, while being used
in a pthread_cond_wait(3C) or pthread_cond_timedwait(3C)) by another thread.
EINVAL The value specified by mutex is invalid.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
pthread_cond_wait(3C), pthread_mutex_lock(3C), pthread_mutexattr_setprioceiling(3C), pthread_mutexattr_setprotocol(3C), pthread_mutex-
attr_setpshared(3C), pthread_mutexattr_setrobust(3C), pthread_mutexattr_settype(3C), attributes(5), mutex(5), standards(5)
SunOS 5.11 11 Nov 2008 pthread_mutex_init(3C)