find command giving incomplete sentence warning


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find command giving incomplete sentence warning
# 1  
Old 08-22-2012
find command giving incomplete sentence warning

Hi ,

I am adding a line in my shell scripts to delete all the old directory with the below command. On running this command it is coming out with the message
find: incomplete statement
Code:
find /ersdg3/ERS/ERS_INPUT_LOGS/RIO/rio_archive -type d -mtime +47 -exec rm -rf {}

What is wrong or missing in it.

My os sun solaris 10

Guddu

Last edited by Franklin52; 08-22-2012 at 08:51 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 08-22-2012
Are the following alternatives working?
Code:
find /ersdg3/ERS/ERS_INPUT_LOGS/RIO/rio_archive -type d -mtime +47 -exec rm -rf {} +

Code:
find /ersdg3/ERS/ERS_INPUT_LOGS/RIO/rio_archive -type d -mtime +47 -exec rm -rf {} \;


Last edited by elixir_sinari; 08-22-2012 at 08:55 AM..
# 3  
Old 08-22-2012
Quote:
Originally Posted by elixir_sinari
Are the following alternatives working?
Code:
find /ersdg3/ERS/ERS_INPUT_LOGS/RIO/rio_archive -type d -mtime +47 -exec rm -rf {} +

Code:
find /ersdg3/ERS/ERS_INPUT_LOGS/RIO/rio_archive -type d -mtime +47 -exec rm -rf {} \;


I tried your first option and it worked, that is the command '+' will do and in 2nd option \; will do
# 4  
Old 08-22-2012
The find -exec primary's synopsis lines from the POSIX standard are:
Code:
−exec utility_name [argument . . .] ;
−exec utility_name [argument . . .] { } +

When entering the 1st form on a shell command line, you have to use \; instead of just ; because the semicolon has a special meaning to the shell. In the first form, if any argument is {}, it will be replaced by the currently matched pathname, and utility_name will be invoked with the modified argument(s). When using this form, some (but not all) find implementations will replace any occurrence of {} in an argument with the pathname; others only replace {} when those two characters are the only characters in the argument.

In the second form, the {} can only appear once and it must be the last argument before the -exec primary's terminating + operand. In this form, utility_name may be invoked with the given arguments and several matched pathnames. The number of pathnames that can be passed to the given utility will be limited by the system's setting for {ARG_MAX} (the maximum number of bytes that can be passed to a child process in its environment and argument lists). If you are processing a lot of files, only use the pathname a single time and as the last argument in the argument list, and the utility accepts multiple pathname operands, this form can be significantly more efficient.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find command giving bad status error

In a fastload teradata utility I am trying to delete the files which are older than 30days using the find and rm command as following. find . -name 'xxx_*' -mtime +30 -exec rm -f {} \; I expect it to delete all the files older than 30 days but sometimes it gives an error : find: bad status--... (3 Replies)
Discussion started by: stelkar
3 Replies

2. UNIX for Beginners Questions & Answers

Split Command Generating Incomplete Output Files

Hello All, May i please know how do i ensure my split command would NOT generate incomplete output files like below, the last lines in each file is missing some columns or last line is complete. split -b 50GB File File_ File_aa |551|70210203|xxxxxxx|12/22/2010 20:44:58|11/01/2010... (1 Reply)
Discussion started by: Ariean
1 Replies

3. Shell Programming and Scripting

Grep command giving different result for different users for same command

Hello, I am running below command as root user #nodetool cfstats tests | grep "Memtable switch count" Memtable switch count: 12 Where as when I try to run same command as another user it gives different result. #su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies

4. Shell Programming and Scripting

Help with searching a word,find the identifier under which it is there and giving a report

Hi, i have a directory structure which contains few files each. each file in turn has some functions. i'm searching for a word, say 'pen' in all the files present in all the directories. :wall: consider a file file1.c in Dir1. out of the 3 funcs present in this file, func1(pennum) and... (3 Replies)
Discussion started by: i.srini89
3 Replies

5. UNIX for Advanced & Expert Users

find -exec with 2 commands doesn't work (error incomplete staement)

Hi Gurues, I need to modify an existing script that uses find to search a folder, and then move its contents to a folder. What I need to do is run gzip on each file after it's moved. So, I ran this little test: Put a ls.tar file on my $HOME, mkdir tmp, and then: virtuo@tnpmprd01: find .... (3 Replies)
Discussion started by: llagos
3 Replies

6. UNIX for Dummies Questions & Answers

Script to ask for a sentence and then count number of spaces in the sentence

Hi People, I need some Help to write a unix script that asks for a sentence to be typed out then with the sentence. Counts the number of spaces within the sentence and then echo's out "The Number Of Spaces In The Sentence is 4" as a example Thanks Danielle (12 Replies)
Discussion started by: charlie101208
12 Replies

7. HP-UX

find -mtime giving strage results in HP-UX

Hi, I am using HP-UX B.11.23 U ia64 I am trying to retrieve files using -mtime option of find command However I found that -mtime is not giving correct results Following is the output of commands executed on 03-Dec-2009 It can be seen that -mtime +1 should have returned all... (2 Replies)
Discussion started by: Chetanaz
2 Replies

8. Solaris

make[2]: warning: Clock skew detected. Your build may be incomplete.

dear all when i compile any file under solaris it gives the below warning how can i disable it -bash-3.00$ make GNLPFT177 make: Warning: File `GNLPFT177.rc' has modification time 36 s in the future make GNLPFT177.c make: Entering directory `/devapp/jordev/batch/source' make: Warning: File... (3 Replies)
Discussion started by: murad.jaber
3 Replies

9. Shell Programming and Scripting

how to find capital letter names in a file without finding words at start of sentence

Hi, I want to be able to list all the names in a file which begin with a capital letter, but I don't want it to list words that begin a new sentence. Is there any way round this? Thanks for your help. (1 Reply)
Discussion started by: kev269
1 Replies

10. UNIX for Dummies Questions & Answers

find command not giving file names accord. to timestamps

Currently iam working on solaris environment, Iam using find command to get list of all files between any two given dates. But the find command is not listing files accord. to timestamp. I tried using -exec option as -exec ls -ltr {} \; Still the files are not listed according to timestamp..... (8 Replies)
Discussion started by: thanuman
8 Replies
Login or Register to Ask a Question