4
0
I want to, from a root dir, find all dirs that contain a certain file name (pom.xml), then cd to that dir and execute a command. I can do this in a script but I was hoping to do this with a single line command.
so far I have
find . -type f -name 'pom.xml' |sed 's#\(.*\)/.*#\1#'
This gives the dirs I need... now I need to cd into each and execute my command
why do you need to cd to the directory to execute your command? Just execute the command on
/path/to/pom.xml
– None – 2010-03-09T14:42:31.883This question clearly says you aren't writing any kind of shell script, it belongs on superuser – Tim Post – 2010-03-09T14:52:48.407
1@tim he's trying to avoid programming which should be any programmers first thought ;) – sfussenegger – 2010-03-09T15:06:26.630
@ dnagirl the command is executing a script that creates new dirs etc in the dir with the pom.xml file
@ want is as a one liner so its easy to distribute – None – 2010-03-09T16:56:45.050