Sponsored Content
Top Forums Shell Programming and Scripting Better way to do tailing with awk Post 302865207 by SkySmart on Friday 18th of October 2013 12:11:19 AM
Old 10-18-2013
thank you so much guys. this just saved me a lot of time!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

tailing logs

Hi I'd like to achieve the ff functionality; tail -f log | grep keyword ...... and then perform a function. That is, I like to tail a log and when a certain keyword appears I then want my script to play an audio file for example. Any ideas?? Cheers M (1 Reply)
Discussion started by: squeakywheel
1 Replies

2. Shell Programming and Scripting

Tailing 2 or more log files simultaneously PERL

Hi, I am having issue where I have to tail 3 log files continuously (forever) and while I am reading the files , parse them and shove the data into DB. I can do this with one file totally fine but how can I read 3 files at the same time? I am not really looking for code (but would be nice) but... (3 Replies)
Discussion started by: Dabheeruz
3 Replies

3. Shell Programming and Scripting

Tailing new log file & echo the string on console

Guys, I do have a script that runs to take the server out from network, after running the script it is writing the new log file{outFile} in to directory . Now what i need is my script should tail the last modified file{outFile} & search the string {Server Status} ans should echo the same at the... (0 Replies)
Discussion started by: raghunsi
0 Replies

4. Shell Programming and Scripting

Tailing last modified part of log file

I have a log file which contains data like this This log file is updated twice a day at 7am and 6pm, I want a script(which i will make run at 7:10am and 6:10pm) which should fetch only the last appended lines since last update.. I mean.. if i execute the script at 7.10am 3/3/2010 it... (4 Replies)
Discussion started by: user__user3110
4 Replies

5. UNIX for Dummies Questions & Answers

tailing a file which contains Control chracters

Hi. I have a log file which gets updated by a java process and it uses ASCII STX and ETX characters (i.e CTRL-B and CTRL-C characters) to demarcate each XML message logged. so the format of the file is something like STX XML_MESSAGE1 .. .. ETX STX XML_MESSAGE2 .. .. ETX each XML... (4 Replies)
Discussion started by: gregoryp
4 Replies

6. Shell Programming and Scripting

Tailing and counting lines

tail -f /var/log/syslog | egrep -c FATAL is there a way to do the above and actually have the number of lines matching the pattern increment as it is logged to the log file? for instance, when you invoke a command like the one i just posted, you'll not get the total lines unless you do... (4 Replies)
Discussion started by: SkySmart
4 Replies

7. Shell Programming and Scripting

Tailing logs from different files into one single file

Hi Please help me in finding a solution for tailing multiple log files and writing all of them into one common file. I have 4 log files with same name in 4 different folders. Whenever I post a Request - any one of these 4 log files gets updated with some log detail in the below format : ... (5 Replies)
Discussion started by: nisav
5 Replies

8. Shell Programming and Scripting

awk logic for tailing and printing

if the last line of an output contains a certain string 'FAILED', i want to print 200 lines from the output. here's where I got stuck: process blah blah blah | awk '{if ($0 ~ /FAILED/) y=x "\n" $0; x=$0};END{print y}' the above only prints the last 2 lines, and it also searches the... (19 Replies)
Discussion started by: SkySmart
19 Replies

9. Shell Programming and Scripting

[BASH] Getting a semi-tailing backslash when passing (escaped) variables to script

Heyas Figured me had a 'typo' in tui-conf-set, i went to fix it. Now, i also figured, it might be nice to have tui-conf-set report (to console, not only exit code) wether it could save the variable to the file or not. This said, I appended this code: (the tui-title and tui-echo lines are... (3 Replies)
Discussion started by: sea
3 Replies

10. Shell Programming and Scripting

Substitution to remove tailing slash?

Heyas I am trying to remove a tailing space, with substitution. Already tried some multiple escapes with no luck, is that even possible? echo $CHROOT || \ CHROOT="${CHROOT/\/$}" echo $CHROOT return And all i get is: :) paths $ CHROOT=/usr/local/ + paths $ . * /usr/local/ /usr/local/... (2 Replies)
Discussion started by: sea
2 Replies
setuid(2)							   System Calls 							 setuid(2)

NAME
setuid, setegid, seteuid, setgid - set user and group IDs SYNOPSIS
#include <sys/types.h> #include <unistd.h> int setuid(uid_t uid); int setgid(gid_t gid); int seteuid(uid_t euid); int setegid(gid_t egid); DESCRIPTION
The setuid() function sets the real user ID, effective user ID, and saved user ID of the calling process. The setgid() function sets the real group ID, effective group ID, and saved group ID of the calling process. The setegid() and seteuid() functions set the effective group and user IDs respectively for the calling process. See Intro(2) for more information on real, effective, and saved user and group IDs. At login time, the real user ID, effective user ID, and saved user ID of the login process are set to the login ID of the user responsible for the creation of the process. The same is true for the real, effective, and saved group IDs; they are set to the group ID of the user responsible for the creation of the process. When a process calls one of the exec(2) family of functions to execute a file (program), the user and/or group identifiers associated with the process can change. If the file executed is a set-user-ID file, the effective and saved user IDs of the process are set to the owner of the file executed. If the file executed is a set-group-ID file, the effective and saved group IDs of the process are set to the group of the file executed. If the file executed is not a set-user-ID or set-group-ID file, the effective user ID, saved user ID, effective group ID, and saved group ID are not changed. If the {PRIV_PROC_SETID} privilege is asserted in the effective set of the process calling setuid(), the real, effective, and saved user IDs are set to the uid argument. If the uid argument is 0 and none of the saved, effective or real UID is 0, additional restrictions apply. See privileges(5). If the {PRIV_PROC_SETID} privilege is not asserted in the effective set, but uid is either the real user ID or the saved user ID of the calling process, the effective user ID is set to uid. If the {PRIV_PROC_SETID} privilege is asserted in the effective set of the process calling setgid(), the real, effective, and saved group IDs are set to the gid argument. If the {PRIV_PROC_SETID} privilege is not asserted in the effective set, but gid is either the real group ID or the saved group ID of the calling process, the effective group ID is set to gid. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The setuid() and setgid() functions will fail if: EINVAL The value of uid or gid is out of range. EPERM For setuid() and seteuid(), the {PRIV_PROC_SETID} privilege is not asserted in the effective set of the calling process and the uid argument does not match either the real or saved user IDs, or an attempt is made to change to UID 0 and none of the existing UIDs is 0, in which case additional privileges are required. For setgid() and setegid(), the {PRIV_PROC_SETID} privilege is not asserted in the effective set and the gid argument does not match either the real or saved group IDs. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
Intro(2), exec(2), getgroups(2), getuid(2), stat.h(3HEAD), attributes(5), privileges(5), standards(5) SunOS 5.11 20 Jan 2003 setuid(2)
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy