![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding Multiple Lines to Multiple Files | dayinthelife | Shell Programming and Scripting | 2 | 06-04-2008 12:50 PM |
| Simultaneous searching for files (names matching certain criteria) in several directo | Hopeful | AIX | 0 | 02-13-2008 02:31 PM |
| deleting files and folders matching criteria | H3001 | Shell Programming and Scripting | 4 | 06-25-2007 09:20 AM |
| Please Help. Need Help searching for multiple stings in a file and removing them. | mjs3221 | UNIX for Advanced & Expert Users | 2 | 08-19-2006 07:28 AM |
| Searching multiple files with multiple expressions | Anahka | Shell Programming and Scripting | 6 | 01-07-2004 06:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Searching for multiple criteria in log files?
I would like a simple shell script that will allow me to display to screen all unsuccessful su attempts in my sulog file, for the present date.
I have been trying several different combinations of commands, but I can't quite get the syntax correct. The mess I have right now (don't laugh) is this: #!/bin/bash DATE = `date " +%b %d"` grep $DATE >/dev/null if ($4 == "-"); then printf fi You can see what I'm trying to accomplish here, but I'm stuck at this point. I tried reading to see if there was a way to use a complex grep or egrep command, but that was a little too complicated for me at this point. Would someone please help me? Thank you |
|
||||
|
I just would like a simple script that I could use over and over that will search the sulog and print to the screen any failed attempts for whatever the date is at the present time.
I tried playing around with the find command, but I can't figure out how to combine multiple criteria. I want to find only files without a "+" in the 4th column of the row, such as: if ($4 == "-") but having the current date in the second column. What I was trying to do was something like: find . -not "+" -a -exec date '{}' \; -print but obviously doesn't work. |
![]() |
| Bookmarks |
| Tags |
| grep or |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|