02-22-2005
Another Find Problem
HI All,
I am having a bit of trouble using the find command in my shell (korn) script.
I was hoping someone could help me.
I am trying to build up a dynamic find command based on some parameters.
When I execute the command I get the following error:
find: incomplete statement
I have attached a stripped down version of the code which has the problem.
Any help would be apprecieated.
Thanks
if [ -n "$opt_file" ]
then
cat_str='\| nice -n 15 cat > '${opt_file}
else
cat_str='\| more'
fi
if [ -n "$opt_operator" ]
then
grep_str='\|nice -n 15 grep '${grep_str}
fi
if [ "$opt_enddate" -eq "$opt_startdate" ]
then
theExecStr="nice -n 15 find . -name \*.gz -exec nice -n 15 gunzip -c {} \; ${grep_str}${cat_str}"
$theExecStr
fi
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
Have the following snippet of code that I'm having trouble trying to work ...
The snippet of code is running on our Production Server and the intent is to copy the second most recent IDE file across from the Development Server.
I have the following files defined in $DEVLOC ...... (4 Replies)
Discussion started by: Cameron
4 Replies
2. Shell Programming and Scripting
Hi,
Iam having a strange problem, wandering if soneone can throw some lights.
I have statement
find . -maxdepth 1 -name 'File1*.tsv' -mtime +1 -print
I expect the above statement to print the files older than 1 day or 24 hrs,
however it doesn't work that way. When issue above command,... (2 Replies)
Discussion started by: braindrain
2 Replies
3. UNIX for Dummies Questions & Answers
When I am doing the first command the result shows all the files, links, directories except the ones that contain the word logs
find . -type f -o -type l -o -type d | grep -v logs
But when I am trying to do this even the logs are getting tarred
tar -cvf fdtvision.tar `find . -type f -o -type l... (2 Replies)
Discussion started by: venu_nbk
2 Replies
4. UNIX for Dummies Questions & Answers
I am using HP-UNIX , The below command doesnt display anything although i have changed a file in the directory by
toutch -t 200010101800 nfile
find /tmp/transfer/ -name "*.*" -mtime +1
Any problrm with the find command i written . .Please help ??..
Thanks,
Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies
5. Shell Programming and Scripting
Hi All,
I am using following find command to delete the records older than 7 days but getting missing conjuction error.Kindly suggest:
The command is:
find <complete_dir_path> \(! -name usr -prune \) -type f -name "*.txt" -mtime +6 -print | xargs rm (11 Replies)
Discussion started by: visingha
11 Replies
6. Shell Programming and Scripting
I'm trying to display the full file name (including the full path) and file size of all files whose name (excluding the path) is longer than 10 characters.
I came up with find path -type f -name ".{10, }" -printf "%s %p\n", but I'm getting a "find: path: No such file or directory". What's wrong... (2 Replies)
Discussion started by: raidkridley
2 Replies
7. Shell Programming and Scripting
for index in `find /root -name *.jar | grep "/lib"`; do echo "$index"; done
sometimes its throwing error saying
find: paths must precede expression
Usage: find
some1 suggested me that :
Code:
for index in `find /technologies -name '*.jar' | grep "/lib"`
do
echo "$index"... (2 Replies)
Discussion started by: crackthehit007
2 Replies
8. Shell Programming and Scripting
Hi
I want to find files with size +10000M and specified directorys except
when i use more than one `-name` acton is fail
I try -a (and) and -o (-or) but results fail :(
find . \( -name ./oracle* -prune -o -name "*arc*" -prune -o -name "*oracle*" -prune -o -size +10000k \) -exec ls -lh {}... (7 Replies)
Discussion started by: ygemici
7 Replies
9. Shell Programming and Scripting
Hello Guys ,
I am trying to run below find command in one of my SH script on a HP UX machine.
find /tmp -type f -name "MGCA*.log" -prune -exec rm -f {} \; 2>&1
I want this to check my tmp directory and delete MGCA log files .But below error message is printed on Promt :-
find: cannot... (2 Replies)
Discussion started by: himanshu sood
2 Replies
10. Shell Programming and Scripting
Hello,
I have trouble using the find command (I am working on Mac OSX).
for i in *.pdf
do
if find . -name "EV"
then
mv "$i" E-test.pdf
elif find . -name "GV"
then
mv "$i" G-test.pdf
else
mv "$i" test.pdf
fi
done
As to the use of "$i": unfortunately, the filenames... (14 Replies)
Discussion started by: tempestas
14 Replies
nice(3) Library Functions Manual nice(3)
NAME
nice - Changes the scheduling priority of a process
LIBRARY
Standard C Library (libc) Berkeley Compatibility Library (libbsd)
SYNOPSIS
#include <unistd.h>
int nice( int increment);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
nice(): XSH4.2
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Specifies a value that is added to the current process priority. You can specify a negative value.
DESCRIPTION
The nice() function adds the value specified in the increment parameter to the nice value of the calling process. The nice value is a non-
negative number; a higher nice value gives the process a lower CPU priority.
When you are using the Standard C Library version of the nice() function, the maximum nice value for a process is 39 (2 * {NZERO} -1) and
the minimum is 0 (zero). Requests for values outside these limits result in the nice value being set to the corresponding limit.
[XPG4-UNIX] If execution of the Standard C Library nice() function fails, the system does not alter the specified priority.
Any process can lower its priority (numerically raise its nice value). A process must have superuser privileges to raise its priority
(numerically lower its nice value).
[Tru64 UNIX] For backward compatibility, a version of the nice() function is supported that allows nice values in the range of -20 to 20.
Requests for values above or below these limits result in the nice value being set to the corresponding limit. To use the backward-compat-
ible version of nice(), compile with the Berkeley Compatibility Library (libbsd.a).
RETURN VALUES
Upon successful completion, the nice() function returns the new nice value minus 20 ({NZERO}). Otherwise, the function returns -1 and sets
errno to indicate the error.
ERRORS
The Standard C Library version of nice() sets errno to the specified values for the following conditions: The calling process does not have
appropriate privilege.
[Tru64 UNIX] The libbsd.a version of nice() sets errno to the same values as the setpriority() function. For information about possible
return values for the setpriority() function, see setpriority(2).
RELATED INFORMATION
Functions: exec(2), getpriority(2), setpriority(2)
Standards: standards(5) delim off
nice(3)