LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-16-2012, 06:59 PM   #1
IAnilkumar
LQ Newbie
 
Registered: Nov 2012
Posts: 3

Rep: Reputation: Disabled
find: missing argument to `-exec'


I have written a perl script

my @pin_conf_files = `find . -name "create*.opc" -exec grep -l PIN_FLD_PASSWD_CLEAR {} \;`;

when i compile it throws an error:

find: missing argument to `-exec'

It works on the command prompt.

> find . -name "create*.opc" -exec grep -l PIN_FLD_PASSWD_CLEAR {} \;
./product_priority_test/create_cust_prio.039.opc
./product_priority_test/create_cust_prio.037.opc
./product_priority_test/create_cust_prio.035.opc
./product_priority_test/create_cust_prio.038.opc
./product_priority_test/create_cust_prio.040.opc
./product_priority_test/create_cust_prio.036.opc
./discountable_1_test/create_cust.053to058.opc
./system_product_test/create_cust.088.opc
./date_range_test/create_cust_datetimetest.opc
./date_range_test/create_cust_datetimefail.opc
./sponsorship_test/create_cust.001.opc
./sponsorship_test/create_cust.003.opc
./sponsorship_test/create_cust.002.opc
./multiple_product_test/create_cust_mprod.044.opc
./multiple_product_test/create_cust_mprod.043.opc
./timeofday_1_test/create_cust.opc
./currency_test/create_cust.067.opc
./currency_test/create_cust.068.opc
./discountable_2_test/create_cust.079.opc
./fold_test/create_cust.042.opc
./proratable_test/create_cust.opc
./timeofday_2_test/create_cust.086.opc
./credit_limits_test/create_cust.066.opc
./timezone_test/create_cust.opc
./quantity_1_test/create_cust_quantity.opc
./status_test/create_cust.opc
./usage_test/create_cust.069.opc
./basic_test/create_cust_basic.opc
./basic_test/create_cust_power.opc
./peak_offpeak_test/create_cust_peak_offpeak.opc
./quantity_2_test/create_cust_quantity2.opc
 
Old 11-17-2012, 01:04 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
It seems some pb with script's execution path. Once try to use full path of "exec" or instead of this, try xargs cmd as:
Code:
find . -name "create*.opc" | xargs grep -l PIN_FLD_PASSWD_CLEAR
 
1 members found this post helpful.
Old 11-19-2012, 01:25 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Don't do it that way, do the whole thing in Perl.
http://perldoc.perl.org/
http://www.perlmonks.org/?node=Tutorials

Code:
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) 
{
    # do something with "$dirname/$file"
}
closedir(DIR)or die "can't closedir $dirname: $!";
 
  


Reply

Tags
perl



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] find in bash script returns "missing argument to `-exec'" while cmd runs fine zhjim Programming 11 01-31-2012 08:56 AM
mv: missing file argument ericczed Linux - Newbie 1 02-01-2010 10:22 PM
Find with -exec argument - not giving proper output..how to find... hinetvenkat Linux - Server 4 01-25-2010 06:19 AM
find: missing argument to `-exec' mkyp Linux - General 4 10-09-2009 11:13 AM
find: missing argument to `-exec' pavodive Linux - Newbie 4 10-05-2009 02:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration