Simple "find" command problem.

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Simple "find" command problem.

#1 Post by sunburnt »

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: Select all

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'

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#2 Post by jpeps »

Is it finding libs to undeb?

Code: Select all

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, 08:19, edited 2 times in total.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#3 Post by jpeps »

duplicate post

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#4 Post by technosaurus »

Code: Select all

for x in `find ...`;do
somethingto $x
done
replace the ... with whatever finds your files
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#5 Post by Karl Godt »

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

Code: Select all

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 .

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#6 Post by jpeps »

Strange---nothing worked yesterday re "-exec", today everything works..quoted or non-quoted.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#7 Post by Pizzasgood »

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: Select all

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: Select all

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.
[size=75]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[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#8 Post by sunburnt »

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.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#9 Post by Pizzasgood »

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.
[size=75]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[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#10 Post by sunburnt »

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

The remakes; Dune, and Children of Dune are very good also.

Post Reply