Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 May 2013, 16:23
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Simple "find" command problem.
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 4005
Location: Arizona, U.S.A.

PostPosted: Wed 21 Dec 2011, 03:36    Post subject:  Simple "find" command problem.  

I downloaded 6 missing libraries for ffmpeg and wanted to undeb all of them.

Tried these commands as find`s help said, both errored the same:
Code:
sh-4.1# find /mnt/sdb3/deb_bin/ffmpeg_i386 -name lib*.deb -exec undeb
find: missing argument to `-exec'

sh-4.1# find /mnt/sdb3/deb_bin/ffmpeg_i386 -name lib*.deb -exec undeb {}
find: missing argument to `-exec'
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 2421

PostPosted: Wed 21 Dec 2011, 04:00    Post subject:  

Is it finding libs to undeb?

Code:

sh-4.1# find /mnt/sdb3/deb_bin/ffmpeg_i386 -name lib*.deb



edit: Yeah.... -exec doesn't seem to work


| xargs [command] works

Last edited by jpeps on Wed 21 Dec 2011, 04:19; edited 2 times in total
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 2421

PostPosted: Wed 21 Dec 2011, 04:01    Post subject:  

duplicate post
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 3843

PostPosted: Wed 21 Dec 2011, 04:33    Post subject:  

Code:
for x in `find ...`;do
somethingto $x
done

replace the ... with whatever finds your files

_________________
Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 2675
Location: Kiel,Germany

PostPosted: Wed 21 Dec 2011, 08:32    Post subject:  

Quote:
find /mnt/sdb3/deb_bin/ffmpeg_i386 -name lib*.deb -exec undeb {}

Code:
find /mnt/sdb3/deb_bin/ffmpeg_i386 -name lib*.deb -exec undeb {} \; -exec echo {} \; -exec ls -l {} \;

I know from amigo .
I read on the net also to '{}' single quote or doubble quote the curved brackets .
Back to top
View user's profile Send private message Visit poster's website 
jpeps

Joined: 31 May 2008
Posts: 2421

PostPosted: Wed 21 Dec 2011, 12:30    Post subject:  

Strange---nothing worked yesterday re "-exec", today everything works..quoted or non-quoted.
Back to top
View user's profile Send private message 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Wed 21 Dec 2011, 13:21    Post subject:  

The error in the OP is that it needs either a \; or a \+ at the end of the -exec argument (as well as the {}). That's how find knows where the end is. The difference between \; and \+ is that with \; it runs the command once per find, whereas with \+ it combines the results into one command.

Code:
find /mnt/sdb3/deb_bin/ffmpeg_i386 -name lib\*.deb -exec undeb {} \;

#equivalent to:

undeb /mnt/sdb3/deb_bin/ffmpeg_i386/libCooper.deb
undeb /mnt/sdb3/deb_bin/ffmpeg_i386/libMarla.deb
undeb /mnt/sdb3/deb_bin/ffmpeg_i386/libStuart.deb
undeb /mnt/sdb3/deb_bin/ffmpeg_i386/libVal.deb


Code:
find /mnt/sdb3/deb_bin/ffmpeg_i386 -name lib\*.deb -exec undeb {} \+

#equivalent to:

undeb /mnt/sdb3/deb_bin/ffmpeg_i386/libCooper.deb /mnt/sdb3/deb_bin/ffmpeg_i386/libMarla.deb /mnt/sdb3/deb_bin/ffmpeg_i386/libStuart.deb /mnt/sdb3/deb_bin/ffmpeg_i386/libVal.deb


Also, it's a good idea to escape or quote name arguments that have asterisks, so that the shell doesn't try to expand them before sending them to find. Otherwise if you have any files in the local directory that match the name pattern, your name option will be expanded into them before being sent to find, which is probably not what you want.

The code technosaurus posted will work as long as the filenames don't have spaces in them. If there are spaces, it is better to use the -exec argument of find. Using -exec with the \+ can also be more efficient than a for loop, depending on what you're doing.

_________________
Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 4005
Location: Arizona, U.S.A.

PostPosted: Wed 21 Dec 2011, 17:39    Post subject:  

Thanks everyone...

Pizzasgood; I seem to recall ( I think ) amigo telling me this awhile back.

Note: I thought once I tried multiple files with undeb and it didn`t work.

# I see you`re a fan of Dune Pizzasgood. The original or the remake?

Added it to my code snips.
The code snips file is getting pretty long, time for a snips/clips manager.
Back to top
View user's profile Send private message 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Mon 26 Dec 2011, 13:22    Post subject:  

I don't think I've ever tried undeb on multiple files.

I'm a fan of the books. Haven't gotten around to watching the movie yet. It's on my list of movies to watch sometime.

_________________
Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 4005
Location: Arizona, U.S.A.

PostPosted: Mon 26 Dec 2011, 15:18    Post subject:  

The original with Kyle MacLaughlin is my favorite, but hard to find.

The remakes; Dune, and Children of Dune are very good also.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0685s ][ Queries: 12 (0.0101s) ][ GZIP on ]