Sponsored Content
Top Forums Shell Programming and Scripting Grep: Return a user message when no hits Post 302531439 by alan on Thursday 16th of June 2011 07:34:20 PM
Old 06-16-2011
Code:
find . -name "R*VER" -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \; |
        awk -F: '
                BEGIN { q="\047" }
                {
                        file=$1
                        result=$2
                        sub(/^.*\//,"",file)
                        split(file,a,/~/)
                        print "INSERT INTO MYTABLE (COL1,COL2,COL3,COL4,COL5,COL6,COL7,COL8) VALUES (" q file q "," q result q "," q a[1] q "," q a[2] q "," q a[7] q "," q a[8] q "," q a[9] q "," q a[10] q ")"
                }
        '

Took care of it.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Return a message when a file is not found

Hi there, I am writing a script to look for tmp log files that have not been access within the last 10 days. I am using the follwing command within the script: find /var/tmp -name *log -atime -9 ¦xargs What I would like to be able to do would be to display a message if there is no... (3 Replies)
Discussion started by: lodey
3 Replies

2. Shell Programming and Scripting

problem in the return of grep

hi, i am running this command inside the script var=`grep -il $1 "${logdir}"* | xargs grep -ivl adding | xargs grep -ivl equation | xargs ls -ctr | tail -1` in that grep will find the latest logfile for the variable "$" if it fnd the logfile, then it reutrns the filename to the var if... (1 Reply)
Discussion started by: mail2sant
1 Replies

3. UNIX for Dummies Questions & Answers

Return mail message

Hi I would like to know how interpret line by line a return mail message sent by unix mailer-daemon (2 Replies)
Discussion started by: alcvrjo
2 Replies

4. UNIX for Dummies Questions & Answers

| help | unix | grep - Can I use grep to return a string with exactly n matches?

Hello, I looking to use grep to return a string with exactly n matches. I'm building off this: ls -aLl /bin | grep '^.\{9\}x' | tr -s ' ' -rwxr-xr-x 1 root root 632816 Nov 25 2008 vi -rwxr-xr-x 1 root root 632816 Nov 25 2008 view -rwxr-xr-x 1 root root 16008 May 25 2008... (7 Replies)
Discussion started by: MykC
7 Replies

5. Shell Programming and Scripting

grep return more than one line

Hi, I have a lot of log files which contain lines in the format of (date info) or (info), and when I use grep to search for "date" I was able to get the (date info) line, but some info lines are a separate line after the (date info) line... for example like: (date info info info) (date... (8 Replies)
Discussion started by: a27wang
8 Replies

6. UNIX for Advanced & Expert Users

return of grep

Hi, in a script I will do : grep ORA- mylogfile.log If it returns any ORA- (oracle error) I whant to have : echo "subject : RMAN in Error " >> /appli/rap.txt But if no error echo "subject : RMAN OK " >> /appli/rap.txt Can you help me ? The grep return code would it be... (1 Reply)
Discussion started by: big123456
1 Replies

7. Shell Programming and Scripting

How to return a message after command runs?

I have a script like this: echo "enter filername in lowercase" read -e filername exec 2>&1 echo "type the start date in format MM/DD/YYYY" read -e startdate exec 2>&1 echo "enter the end date in format MM/DD/YYYY" ... (2 Replies)
Discussion started by: newbie2010
2 Replies

8. UNIX for Dummies Questions & Answers

Grep for list of files with only found hits

Hi, With grep -ci word * I get a list of files either they have a hit, or the have not (0). I wanted to pipe to a new list of files, which only shows the files where the string was found, and counted, not the whole bunch. How to do this? Any advice welcome! with best regards, Omar... (11 Replies)
Discussion started by: OmarKN
11 Replies
Graphics::Primitive::Insets(3pm)			User Contributed Perl Documentation			  Graphics::Primitive::Insets(3pm)

NAME
Graphics::Primitive::Insets - Space between things DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds something. This object can be used to represent either padding or margins (in the CSS sense, one being inside the bounding box, the other being outside) SYNOPSIS
use Graphics::Primitive::Insets; my $insets = Graphics::Primitive::Insets->new({ top => 5, bottom => 5, left => 5, right => 5 }); METHODS
Constructor new Creates a new Graphics::Primitive::Insets. Instance Methods as_array Return these insets as an array in the form of top, right, bottom and left. bottom Set/Get the inset from the bottom. equal_to Determine if these Insets are equal to another. left Set/Get the inset from the left. right Set/Get the inset from the right. top Set/Get the inset from the top. zero Sets all the insets (top, left, bottom, right) to 0. AUTHOR
Cory Watson, "<gphat@cpan.org>" SEE ALSO
perl(1) COPYRIGHT &; LICENSE Copyright 2008-2010 by Cory G Watson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2010-08-21 Graphics::Primitive::Insets(3pm)
All times are GMT -4. The time now is 05:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy