On Monday 24 Jan 2011 13:57:11 Agnello George wrote:
> i got a file like this and i need add it into my svn
> 
> admin/upload_data/FINAL  leg  list  19_01_2010 to  agar  (Merged data in
> one).xls
> 
> i as able to add other files with space using the following command :
> 
>  svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add
> 
> however there are some special characters like ( ) +#@  that svn cannot
> understand as the full path of  the file .
> 
> can some one help me in this in perl or in shell .

1. I suggest you try using Subversion's SVN::Wc API:

http://search.cpan.org/perldoc?SVN::Wc

It is written in C and has bindings for Perl and other languages, and it more 
reliabale than parsing the command line.

2. If that fails you can try this:

[code]

#!/usr/bin/perl

use strict;
use warnings;

open my $svn_st, "svn st|";

my @files_to_add;

while (my $line = <$svn_st>)
{
    chomp($line);

    if ($line =~ m{\A\?})
    {
        push @files_to_add, substr($line,8);
    }
}
close($svn_st);

system("svn", "add", @files_to_add);

[/code]

Note that I've used the list form of perldoc -f system.

Regards,

        Shlomi Fish
-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

Chuck Norris can make the statement "This statement is false" a true one.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to