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 DEBIAN
mtailrc
mtailrc(5) User Manuals mtailrc(5)
NAME
mtailrc - Configuration file for monkeytail
DESCRIPTION
A monkeytail configuration uses Apache-style syntax to declare "groups" of files to be tailed.
Best explained with an example:
<group testgroup>
prefix 'server2: '
sudo yes
<file>
filename /var/log/apache2/access.log
prefix 'server1: '
host server1.example.com
</file>
<file>
filename /var/log/apache2/access.log
host server2.example.com
sudo no
</file>
</group>
OPTIONS
All options can be either put inside a group or file block. Options inside a file block override those in the group block.
filename filename
filename defines the filename for this block.
host remote-host (optional)
host defines that this block's file is to be tailed on a remote server.
sudo yes|no|1|0
sudo is a boolean specifying whether this file should be tailed as root. This option is supported for both local and remote files
(in both cases you will potentially be prompted for your password).
prefix "string: "
prefix allows you to specify a short string that will be prepended to every line that is displayed for that given file.
FILES
~/.mtailrc - user specific monkeytail config
SEE ALSO
mtail(1), tail(1)
AUTHOR
Martyn Smith <martyn@dollyfish.net.nz>
mtail May 2008 mtailrc(5)