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
sem_init
sem_init(3C) Standard C Library Functions sem_init(3C)
NAME
sem_init - initialize an unnamed semaphore
SYNOPSIS
#include <semaphore.h>
int sem_init(sem_t *sem, int pshared, unsigned int value);
DESCRIPTION
The sem_init() function is used to initialize the unnamed semaphore referred to by sem. The value of the initialized semaphore is value.
Following a successful call to sem_init(), the semaphore may be used in subsequent calls to sem_wait(3C), sem_trywait(3C), sem_post(3C),
and sem_destroy(3C). This semaphore remains usable until the semaphore is destroyed.
If the pshared argument has a non-zero value, then the semaphore is shared between processes; in this case, any process that can access the
semaphore sem can use sem for performing sem_wait(3C), sem_trywait(3C), sem_post(3C), and sem_destroy(3C) operations.
Only sem itself may be used for performing synchronization. The result of referring to copies of sem in calls to sem_wait(3C), sem_try-
wait(3C), sem_post(3C), and sem_destroy(3C), is undefined.
If the pshared argument is zero, then the semaphore is shared between threads of the process; any thread in this process can use sem for
performing sem_wait(3C), sem_trywait(3C), sem_post(3C), and sem_destroy(3C) operations. The use of the semaphore by threads other than
those created in the same process is undefined.
Attempting to initialize an already initialized semaphore results in undefined behavior.
RETURN VALUES
Upon successful completion, the function initializes the semaphore in sem. Otherwise, it returns -1 and sets errno to indicate the error.
ERRORS
The sem_init() function will fail if:
EINVAL The value argument exceeds SEM_VALUE_MAX.
ENOSPC A resource required to initialize the semaphore has been exhausted, or the resources have reached the limit on semaphores
(SEM_NSEMS_MAX).
ENOSYS The sem_init() function is not supported by the system.
EPERM The process lacks the appropriate privileges to initialize the semaphore.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
|ATTRIBUTE TYPE |ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
|Standard |See standards(5). |
+-----------------------------+-----------------------------+
SEE ALSO
sem_destroy(3C), sem_post(3C), sem_wait(3C), attributes(5), standards(5)
SunOS 5.11 5 Feb 2008 sem_init(3C)