That was just an example, the .txt file(s) is/are either in the main directory or in subdirectorys and debugme is a variable. I guess that find is necessary?
Oh and I'm looking for the most effective way of doing this in bash, no perl
ps. I've tested your suggestions, here is the result:
---------- Post updated at 05:14 PM ---------- Previous update was at 02:36 PM ----------
So nobody has any suggestions on how to make it run quicker?
---------- Post updated 11-05-09 at 04:29 AM ---------- Previous update was 11-04-09 at 05:14 PM ----------
Seriously I though that some of the experts here would know how to optimize such a task :/
Can somebody please guide me towards right syntax:
#!/bin/ksh
if i = $(grep $NAME filename)
echo "Name Found"
else
echo " Name not Found"
fi
I need to grep for $NAME in the file, and if it returns false, execute a series of commands and if true, exit out.
The above is not the right... (3 Replies)
Hi All,
I am using grep command to find string "abc" in one file .
content of file is
***********
abc = xyz
def= lmn
************
i have given the below mentioned command to redirect the output to tmp file
grep abc file | sort -u | awk '{print #3}' > out_file
Then i am searching... (2 Replies)
hello experts,
i am trying to replace a line in a 100+mb text file. the structure is similar to the passwd file, id:value1:value2 and so on. using the sed command
sed -i 's/\(123\):\(\{1,\}\):/\1:bar:/' data.txt
works nicely, the line "123:foo:" is replaced by "123:bar:". however, it takes... (7 Replies)
Hi All,
Please can somebody advise that if I want to search a pattern xyz the grep command should only select xyz and not any other pattern containing xyz (ex abxyzcd)
Regards (1 Reply)
Hi,
I have to find out the run time for 40-45 different componets. These components writes in to a genreric log file in a single directory.
eg.
directory is LOG and the log file name format is generic_log_<process_id>_<date YY_MM_DD_HH_MM_SS>.log
i am taking the run time using the time... (3 Replies)
Hi,
I have an array with characters and I am looking for specific character in that array and if those specific character not found than I use goto statment which is define somehwhere in the script. My code is:
set a = (A B C D E F)
@ i = 0
while ($i <= ${#a})
if ($a != "F" || $a != "D")... (3 Replies)
Hello All,
I have 2 different pieces of code, I am confused why the Code1 is giving me the correct result where as the Code2 is not giving me correct result. It gives me always result as "Failure" irrespective of the "ERROR" word exists in logfile or not. may I know the reason why? I am using Bash... (17 Replies)
Below script is used to search numeric data from around 400 files in a folder. I have 300 such folders. Need help in performance improvement in the script.
Below Script searches 20 such folders ( 300 files in each folder) simultaneously. This increases cpu utilization upto 90% What changes... (3 Replies)
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
LEARN ABOUT OPENSOLARIS
setregid
setregid(2) System Calls setregid(2)NAME
setregid - set real and effective group IDs
SYNOPSIS
#include <unistd.h>
int setregid(gid_t rgid, gid_t egid);
DESCRIPTION
The setregid() function is used to set the real and effective group IDs of the calling process. If rgid is -1, the real group ID is not
changed; if egid is -1, the effective group ID is not changed. The real and effective group IDs may be set to different values in the same
call.
If the {PRIV_PROC_SETID} privilege is asserted in the effective set of the calling process, the real group ID and the effective group ID
can be set to any legal value.
If the {PRIV_PROC_SETID} privilege is not asserted in the effective set of the calling process, either the real group ID can be set to the
saved set-group-ID from execve(2), or the effective group ID can either be set to the saved set-group-ID or the real group ID.
In either case, if the real group ID is being changed (that is, if rgid is not -1), or the effective group ID is being changed to a value
not equal to the real group ID, the saved set-group-ID is set equal to the new effective group ID.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned, errno is set to indicate the error, and neither of the group IDs will
be changed.
ERRORS
The setregid() function will fail if:
EINVAL The value of rgid or egid is less than 0 or greater than UID_MAX (defined in <limits.h>).
EPERM The {PRIV_PROC_SETID} privilege is not asserted in the effective set of the calling processes and a change was specified other
than changing the real group ID to the saved set-group-ID or changing the effective group ID to the real group ID or the saved
group ID.
USAGE
If a set-group-ID process sets its effective group ID to its real group ID, it can still set its effective group ID back to the saved set-
group-ID.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO execve(2), getgid(2), setreuid(2), setuid(2), attributes(5), privileges(5), standards(5)SunOS 5.11 22 Mar 2004 setregid(2)