Monday, 15 April 2013

unix - Concatenating input to svn list command with output, then pass it to grep -



unix - Concatenating input to svn list command with output, then pass it to grep -

i have next shell command partially working:

svn list $myrepo/libs/ | xargs -p 10 -l 1 -i {} echo $myrepo/libs/ {} trunk | sed 's/ //g' | xargs -p 20 -l 1 svn list --depth infinity | grep .xlsx

where $myrepo corresponds svn server address.

the libs folder contains number of subfolders (currently 30 although 100), each contain number of tags, branches , trunk. wish list of xlsx files contained within trunk folder of each of these subfolders. command above works fine returns relative path $myrepo/libs/subfolder/trunk/, back:

1/2/3/file.xlsx

because of potentially big number of files have search through, performing in 2 parallel steps using xargs -p (i not have , cannot utilize parallels). trying in 1 command can used in php/perl/etc. , avoid multiple sytem calls.

what concatenate input part of command:

xargs -p 20 -l 1 svn list --depth infinity

with output it, give following:

$myrepo/libs/subfolder/trunk/1/2/3/file.xlsx

then pass grep find xlsx files.

i appreciate assistance provided.

if manage correctly divine intention, might work you.

svn list "$myrepo/libs/" | xargs -p 20 -n 1 sh -c 'svn list -r "$0/trunk/$1" | sed -n "s%.*\.xlsx$%$0/trunk/$1/&%p"' "$myrepo"

briefly, postprocess output inner svn list filter .xslx files , tack total svn path on @ same time. way, processing happens repo path still known.

we hack things bit passing in "$myrepo" "$0" subordinate sh don't have export variable. input outer svn list comes $1.

(the repos have access have different layout there copy/paste error somewhere.)

unix svn grep xargs

No comments:

Post a Comment