I have the following command :
ls /some/path/*dat | xargs -n 1 -I @ sh -c "echo `basename @`"
with the directory
/some/path/ containing :
/some/path/a /some/path/b /some/path/c /some/path/d
I want to get the output :
a b c d
But I'm still getting full paths. What am I doing wrong ?
edit: BTW, I know that there is an easier way, I can just run
basname instead of
echo `basename @`
But I need to run a complex command, something like
octave --silent --eval "somefunction('`basename @`','@',...))"
Here is the actual command :
ls ~/phd/data/conll2012/dev.megam/*dat | xargs -P 16 -n 1 -I@ timeout -k 1s 15m sh -c "if [ ! -f '~/phd/xp/conll2012/dev.megam/@.$epsilon$mink$minn$alpha' ]; then octave --silent --eval \"xprp('~/phd/xp/conll2012/dev.megam/@.$epsilon$mink$minn$alpha.rp','@',$alpha,$mink,$minn,$epsilon);\" 2>> ~/xpgrid.log;fi"
Basically, I have a set of files in a directory and this command feeds on these files to output result in another directory, checking if the result is not already there.
So, I need both files with fullpath and files with only basename.
How to make it work on ? The easier example at the beginning can help make this clearer.