xargs vs exec

xargs is cooler. Thats why…

In trying to delete a bunch of files with similar names  ( REALLY necessary when playing around with the split command ) but there usually is an issue — which presents an inconsistent problem. Sometimes linux barfs and sometimes it behaves…

When issuing this command:   find . -name ‘someFile*’

I will get the output:

./someFileA
./someFileB
./someFileC
etc….

And this kind of input being piped to an xargs rm command doesnt jive all that well. So there is cause for use of the exec command… but its very unwieldy in its usage:

find . -name ‘someFile* -exec rm {} \;

Why is it unwieldy? You mean besides the fact that I wanted to say the word unwieldy? Well, I just don’t understand the syntax. Lets explore:

-exec: acts as a pipe in this instance, but the mechanism is different and those differences are subtle.

the {} seems to act as a transformation to an iterative for each string returned separated by a new line delimiter. It seems to hold true to its Array symbolic reference.

Not sure about the \ and the ; and the option of the +. I will have to look that up later.