09-28-2010
Simple grep script
I'm trying to write a simple script to identify every user who tried to “sudo” on the system. I have the first portion down to grep the log file
grep “sudo” /var/log/secure.
What I want to do is have the script identify the person just one time not every instance the user tried to sudo.
Thanks for your help.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have seen this used several times but not really sure of what it actually does. I am confused with the second grep as the argument to the first.
some commands | grep -v grep | some other commands
Can anyone provide an explanation?
Thanks, (5 Replies)
Discussion started by: google
5 Replies
2. Shell Programming and Scripting
I tried searching for answers but didn't find any.
When I grep a file results read
4.2.2.2
4.4.4.2
4.5.6.7
But I just want to select each result individually. For Example I want to be able to say
variable1="first grep result"
variable2="second grep result"
variable3="third grep... (8 Replies)
Discussion started by: elbombillo
8 Replies
3. Shell Programming and Scripting
Hi, On the log Netscape log, I need to grep for 500 error. I am doing that but I also get 1500 in that same log.
cat access |grep "500"
Results:
"GET /css/RBR.css HTTP/1.1" 200 15000 304 - - - 399 639 523 164 0
This not what I need... Please advice. (4 Replies)
Discussion started by: samnyc
4 Replies
4. Shell Programming and Scripting
Hi all,
Here is my requirement
I have to search 'ORA' word in out.log file,if it is present then i need to send that file (out.log) content to some mail id.If 'ORA' word is not in that file then i need to send 'load succesful' message to some mail id.
The below the shell script is not... (5 Replies)
Discussion started by: mak_boop
5 Replies
5. UNIX for Dummies Questions & Answers
This should be so easy...
I want to find all the apps in /Applications that start with the lower case i (e.g. iTunes.app, iSync.app, iCal.app) They should all have the .app extension. I've tried:
ls /Applications |grep -o i*.app
ls /Applications/i*.app
Anyhow, I just want to see what apps... (2 Replies)
Discussion started by: glev2005
2 Replies
6. Shell Programming and Scripting
Hi guys, I have written this script, however the outcome is invalid. It contains grep search that is not needed:
Script:
#!/bin/bash
#this is a test script
FILES=$(ls /home/student/bin/dir1/*)
GREPFUNC=$(grep -E -i "login|Successfully" ORProxyTC`date '+%m%d%Y'`*.txt/ ${FILES})... (14 Replies)
Discussion started by: DallasT
14 Replies
7. Shell Programming and Scripting
I am currently having a problem with displaying multiple occurences of a line using grep/sed combination. Let's say that I do grep "$anything" $file.
When I do this it only displays a single line, but if I do grep -c "$anything" $file it says that there are 3 occurences of $anything, but how can... (15 Replies)
Discussion started by: puttster
15 Replies
8. Shell Programming and Scripting
Hello,
I am trying to grep my log files for ORA errors, except ORA-00001.
I have tried:
grep 'ORA*!(-00001)' *.log
but it is not working.
Any help will be much appreciated.
Thank you. (5 Replies)
Discussion started by: drbiloukos
5 Replies
9. UNIX for Dummies Questions & Answers
I hope someone can help me.
I have a folder e.g. /opt/application
Under that are many sub folders e.g.
Folder1
Folder2
Folder3
Folder4
Folder5
Folder6
etc
In some of these fodlers (not all of them) is a file called errors.log
I need to run a grep that will start at... (3 Replies)
Discussion started by: gunnahafta
3 Replies
10. Shell Programming and Scripting
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Discussion started by: torchij
16 Replies
LEARN ABOUT OSX
mdnsresponder
mDNSResponder(8) BSD System Manager's Manual mDNSResponder(8)
NAME
mDNSResponder -- Multicast and Unicast DNS daemon
SYNOPSIS
mDNSResponder
DESCRIPTION
mDNSResponder (also known as mdnsd on some systems) is a daemon invoked at boot time to implement Multicast DNS and DNS Service Discovery. On
Mac OS X 10.6 (Snow Leopard), mDNSResponder is also the system-wide Unicast DNS Resolver.
mDNSResponder listens on UDP port 5353 for Multicast DNS Query packets. When it receives a query for which it knows an answer, mDNSResponder
issues the appropriate Multicast DNS Reply packet.
mDNSResponder also performs Unicast and Multicast DNS Queries on behalf of client processes, and maintains a cache of the replies.
mDNSResponder has no user-specifiable command-line argument, and users should not run mDNSResponder manually.
LOGGING
There are several methods with which to examine mDNSResponder's internal state for debugging and diagnostic purposes. The syslog(1) logging
levels map as follows:
Error - Error messages
Warning - Client-initiated operations
Notice - Sleep proxy operations
Info - Informational messages
By default, only log level Error is logged.
A SIGUSR1 signal toggles additional logging, with Warning and Notice enabled by default:
% sudo killall -USR1 mDNSResponder
Once this logging is enabled, users can additionally use syslog(1) to change the log filter for the process. For example, to enable log lev-
els Emergency - Debug:
% sudo syslog -c mDNSResponder -d
A SIGUSR2 signal toggles packet logging:
% sudo killall -USR2 mDNSResponder
A SIGINFO signal will dump a snapshot summary of the internal state to /var/log/system.log:
% sudo killall -INFO mDNSResponder
FILES
/usr/sbin/mDNSResponder
INFO
For information on Multicast DNS, see http://www.multicastdns.org/
For information on DNS Service Discovery, see http://www.dns-sd.org/
For information on how to use the Multicast DNS and the DNS Service Discovery APIs on Mac OS X and other platforms, see
http://developer.apple.com/bonjour/
For the source code to mDNSResponder, see http://developer.apple.com/darwin/projects/bonjour/
BUGS
mDNSResponder bugs are tracked in Apple Radar component "mDNSResponder".
HISTORY
The mDNSResponder daemon first appeared in Mac OS X 10.2 (Jaguar).
Also available from the Darwin open source repository (though not officially supported by Apple) are mDNSResponder daemons for other plat-
forms, including Mac OS 9, Microsoft Windows, Linux, FreeBSD, NetBSD, Solaris, and other POSIX systems.
Darwin June 1, 2019 Darwin