find: missing argument to `-exec' while redirecting using find in perl
Hi Friends,
Please help me to sort out this problem, I am running this in centos o/s and whenever I run this script I am getting "find: missing argument to `-exec' " but when I run the same code in the command line I didn't find any problem. I am using perl script to run this application.
Correct me if I am wrong any where.. This coding is to find the top 3 files in the filesystem with respect to size.
Your feedback is appreciated on this
Moderator's Comments:
Use code tags please, ty. You'll get a PM with a guide.
Last edited by zaxxon; 12-16-2011 at 03:08 PM..
Reason: code tags, see PM
It's probably eating the backslash since perl double-quotes evaluate those. You may need to escape the escaping. You'll probably also need to escape those $ in your awk, since perl evaluates those into variables, and escape the double-quotes i the awk statement, so perl won't mistake them for its own.
I remember writing Perl like that: Line after line after line of nothing but system() and backticks. Eventually I noticed they were starting entire bourne shells just to parse one "mv a b" and was horrified -- by avoiding the shell I'd actually used eight of them consecutively
Returning much later, I rewrote some of these "perl" scripts as shell, making them much smaller, simpler, and saner.
Last edited by Corona688; 12-16-2011 at 03:48 PM..
Correct me if I am wrong any where.. This coding is to find the top 3 files in the filesystem with respect to size.
First thought: Why in the world is this a perl script?
Second thought: don't use ls -h: some files might have a suffix of M; some G (etc). No good.
Third thought: Why are you doing this? Whatever the reason, I think there has got to be a better way. You do not need to be searching your WHOLE filesystem every minute (I'm assuming that's what you're doing based on your find options). With the limited info you've given, I think you would be much better off installing inotify-tools (available in every major distro) and watching only the directories that things are being created in.
this find command works when using manually on the command line
--
$ ls -latr file*.log
-rw-r--r-- 1 oracle dba 75 Jan 4 05:00 file_2.log
-rw-r--r-- 1 oracle dba 75 Jan 4 05:00 file_1.log
$
$ find . ! -name -prune -type f -name "file*.log" -daystart -mtime 2
./file_1.log
./file_2.log
$... (8 Replies)
Guys,
I want to find the log files greather than 23 days and i want to perform 2 things here.
one is to list the files and second is to gzip the files. hope this can be done using sh -c option. but not sure the exact command.
find . -name "*.log" -mtime +23 -exec ls -la {} \;
... (5 Replies)
How can I recursively find all files in a directory and print out the file and first line number of any text blocks that match the below cases?
This would seem to involve find, xargs, *grep, regex, etc.
In summary, I want to find so-called empty "try-catch blocks" that do not contain code... (0 Replies)
Dear Perl's Users,
Could anyone help me how to solve my problem. I have data with details below.
TTY NAME SEQUENCES
U-0 UNIX 0
U-1 UNIX 1
U-2 UNIX 2 <-- From 2 jump to 5
U-5 UNIX 5
U-6 UNIX 6 <-- From 6 jump to 20
U-20 ... (2 Replies)
This is a huge issue. and I need it fixed ASAP.
account-system gate-system race_traffic_sensor
achievement-system global race_voicepack
admin glue-system realdriveby
admin-system gps realism-system... (5 Replies)
Hi
I wish to find only files in dir /srv/container/content/imz06/. It means exclude subfolder /srv/container/content/imz06/archive/
> uname -a
SunOS testbox6 5.10 Generic_139555-08 sun4v sparc SUNW,Sun-Blade-T6320Its Solaris default "find"
> find /srv/container/content/imz06/* -name... (4 Replies)
I am using csh and getting the error "find: No match." but I cannot figure out why. What I am trying to do is set the find command to a variable and then execute the variable as a command. I ran it through a debugger and it looks like $FIND is getting set but the find command can not actually be... (2 Replies)
Hi,
Happy new year.
Would you be so kind to explain me what does this instruction :
find /rep/app -type l -exec ls -l {} \;> allink.lst
Many thanks. (2 Replies)
Hello,
I create a file touch 1201093003 fichcomp
and inside a repertory (which hava a lot of files) I want to list all files created before this file :
find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long
but i make a filter all... (1 Reply)