[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Using svn in a unix pipe

From: Baz <brian.ewins_at_gmail.com>
Date: 2006-05-03 11:24:47 CEST

On 5/3/06, Garrett Rooney <rooneg@electricjellyfish.net> wrote:
> On 5/2/06, Baz <brian.ewins@gmail.com> wrote:
> > try this:
> > svn st | grep ^\? | awk '{ print $2 }' | tr "\n" "\000" | xargs -0 -n1 svn add
>
> The problem is that 'print $2' in awk will only print out the second
> field, and by default it splits on whitespace, so if you've got
> filenames with spaces $2 is only the first chunk of it, so I suspect
> that tr won't help...

Ah... doh! Ok that's solved by cut:
svn st | grep ^\? | cut -c 6- | tr "\n" "\000" | xargs -0 -n1 svn add

(Jorge previously suggested cut -c 6-500 which truncates at 500 chars)
Like Saulius though I usually resort to a single tool, but for me its
perl not sed:
svn st | perl -ne 'print if s/^\?.{5}(.*)/$1\000/' | xargs -0 -n1 svn add

Saulius' sed script fails when there's apostrophes in the filenames.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed May 3 11:26:10 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.