Sponsored Content
Full Discussion: Find statement
Top Forums UNIX for Dummies Questions & Answers Find statement Post 302280308 by jim mcnamara on Monday 26th of January 2009 12:52:20 PM
Old 01-26-2009
try this:
Code:
F=`find /unixs/apps/sqr/ -type f \( -name '*.KSH' -o -name '*.sh' -o -name '*.sql' \) \ 
    -exec grep -il unixs {} \;`

for FNAME in $F 
do 
   C=`grep -c unixs ${FNAME}`
   echo "${C}:${FNAME}" 
done > /unixs/apps/cibcur01.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find/if statement not working

Hi guys: I am trying to delete multiple files in a folder with different names. Below is the script that I was trying, but it doesn't work ************************** #!/bin/ksh DATE=`date '+20%y%m%d'` DEL_DIR=<dir where files have to be deleted> let DATE2=$(($DATE - 2)) let DATE1=$(($DATE... (12 Replies)
Discussion started by: geomonap
12 Replies

2. Shell Programming and Scripting

whats wrong with this find statement ?

cmd="find /a/technologies -name '*.jar' | grep \"Tuning/specificloader/lib\"" echo $cmd for index in `$cmd` do SL_JARS="${SL_JARS}:${index}" done gives error ==> find: paths must precede expression Usage: find but for index in... (2 Replies)
Discussion started by: crackthehit007
2 Replies

3. Shell Programming and Scripting

For loop find statement file name manipulation

for i in `find . -name "*.BEFORE_DISASTER_RECOVERY"`;do dir_name=`dirname $i`;file_name=`basename $i`;cd $dir_name;mv $file_name (STUCK HERE) ;pwd;cd $BASE_DIR;done Okay, so I was able to get to this point. As you can see, I have a small for loop that searches for any files with the string... (5 Replies)
Discussion started by: cbo0485
5 Replies

4. UNIX for Dummies Questions & Answers

echo statement when find returns null

Hi, How do you echo something once when a find statement returns null results? This is when using mutiple locations and mutiple arguments. The below find command the inner loop of a nested for loop where the outter loop holds the $args and the inner loop holds the locations. find... (2 Replies)
Discussion started by: tchoruma
2 Replies

5. Shell Programming and Scripting

awk statement to find events from a specific date

I have a script which archives log file events which are 90-days old. Script works fine but I wanted some input on one aspect of this script. My nawk statement, bolded below, that removes events 90-days prior from today, I need it to find anything 90-days or older. The log file date pattern looks... (0 Replies)
Discussion started by: numele
0 Replies

6. Shell Programming and Scripting

Problems with find | ls within a for statement

Hello, for dir in `find /root/test -type d` ;do echo "$dir" done for dir in `ls -1d /root/test/*/` ;do echo "$dir" done If there's a directory with spaces in name, it does echo each word of that dir separately... solution? mkdir "test" cd test mkdir "example_1_2_3"... (6 Replies)
Discussion started by: TehOne
6 Replies

7. Shell Programming and Scripting

trying to find match from multiple string if statement

I'm trying to create what (should be) a simple bash script that will pull computer name and use that info to bind to one of three servers. Is there any way to do this without having a text file with the names of the servers and associated computer names? (5 Replies)
Discussion started by: jacobsbigbro1
5 Replies

8. UNIX for Dummies Questions & Answers

Statement to find if an entry exists in a file

I need to check if an entry input by the user is in a file. If so, I need to run a command, and if it does not exist then it should output entry does not exist. So I have so far... echo "Enter record:" read record //command || //command Can I use an if statement to do this? (3 Replies)
Discussion started by: itech4814
3 Replies

9. UNIX for Dummies Questions & Answers

Multiple Find Conditions in IF Statement - UNIX

When I try the below if Condition with single condition its working fine. But when I try to Club both its working . But giving wrong results. In my case cond1 = -f ${filename1} = true cond2 = -f ${filename2} = true But Cond1 & Cond2 is resulting in False ??? Please advise ... (5 Replies)
Discussion started by: Shiny_Reddy
5 Replies

10. UNIX for Beginners Questions & Answers

0403-016 Cannot find or open the file in If Statement

Hi, I am comparing the number of records in the .bad record from sql loader, if it is higher than the number passed in as an argument, the program should exit. However, I constantly receive the error " 0403-016 Cannot find or open the file." on the line with the if statement "elif ;". The code... (3 Replies)
Discussion started by: MIA651
3 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 02:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy