Re: [linux] unable to check in code to svn when files contain spaces or characters

2011-01-26 Thread ed
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, Jan 24, 2011 at 08:21:33PM +, ed wrote: ... > @arg = [ "svn", "add", "File with spaces" ]; My bad... as pointed out by Shlomi Fish, this is incorrect and should instead be: @arg = ( "svn"

Re: [linux] unable to check in code to svn when files contain spaces or characters

2011-01-25 Thread Shlomi Fish
. > > > > can some one help me in this in perl or in shell . > > If in perl, then you may want to pass the arguments to the system > command as an array, so: > > @arg = [ "svn", "add", "File with spaces" ]; > system( @arg ); 1. [.

Re: [linux] unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread ed
s in perl or in shell . If in perl, then you may want to pass the arguments to the system command as an array, so: @arg = [ "svn", "add", "File with spaces" ]; system( @arg ); Hope this helps - -- Best regards, Ed http

Re: [CentOS] unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread Nico Kadel-Garcia
On Mon, Jan 24, 2011 at 6:57 AM, 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 First: don't do this, seriously. You're begging for pain in your scripting to handle such files fro

Re: unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread Shlomi Fish
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 -

unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread Agnello George
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 c

Re: how do I replace all the spaces in a string with +

2010-02-25 Thread Jenda Krynicky
From: Erik Lewis > Thanks that probably explains my higher than expected ungeocoded > rate. Two weeks of playing with perl and I feel like I know less than > when I started. The more you learn the more you find out you know nothing ;-) This feeling is to be expected. Don't let it overwhelm

Re: how do I replace all the spaces in a string with +

2010-02-25 Thread Erik Lewis
homp (my $rawaddress = <>); my $geoaddress = $rawaddress =~ s/ /\+/; #strip the spaces from the address my $googlekey = "ABQIJKeZa28YtErALcrbEC0UlBREf5oWR6F07BQvSEe3pww8R4s0VhTfTt- 19vTI9qA-_V1pUf4-_TcfpQ"; #get your google http://code.google.com/apis/maps/signup.html my $geocode_cs

Re: how do I replace all the spaces in a string with +

2010-02-25 Thread Jenda Krynicky
From: Erik Lewis > > print "Enter your address\n"; > > chomp (my $rawaddress = <>); > > my $geoaddress = $rawaddress =~ s/ /\+/; > #strip the spaces from the address > > my $googlekey = > "ABQIJKeZa28YtErALcrbEC0UlBREf5oWR6F07BQvSEe3p

Re: how do I replace all the spaces in a string with +

2010-02-20 Thread Robert Citek
On Fri, Feb 19, 2010 at 3:23 PM, John W. Krahn wrote: > Sergey Matveev wrote: >> >> Greetings, >> >> On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote: >> >>> I have to changes all the spaces in a string to +'s.  Is there an >>>

Re: how do I replace all the spaces in a string with +

2010-02-20 Thread Dr.Ruud
Erik Lewis wrote: I have to changes all the spaces in a string to +'s. Is there an easy way to do this. The length of the string and the number of spaces will always be changing. You are probably looking for tr, see perldoc -f tr. Do you mean chr(32) only, or also other types of

Re: how do I replace all the spaces in a string with +

2010-02-19 Thread Sergey Matveev
Greetings, On Fri, Feb 19, 2010 at 02:23:07PM -0800, John W. Krahn wrote: > You don't have to escape a plus sign in a quoted string: > > $string =~ s/ /+/g; Yeah. I see. I understand my fault. -- Happy hacking, Sergey Matveev FSF Associate member #5968 | FSFE Fellow #1390 -- To unsubscribe,

Re: how do I replace all the spaces in a string with +

2010-02-19 Thread Uri Guttman
> "SM" == Sergey Matveev writes: SM> $string =~ s/ /\+/g; why are you escaping the + there? that is a replacement string, not a regex. it is double quotish but not much more than that. + is just a regular char there like almost all chars in double quoted strings. this is a common thing i

Re: how do I replace all the spaces in a string with +

2010-02-19 Thread John W. Krahn
Sergey Matveev wrote: Greetings, On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote: I have to changes all the spaces in a string to +'s. Is there an easy way to do this. The length of the string and the number of spaces will always be changing. $string =~ s/ /\+/g; That i

Re: how do I replace all the spaces in a string with +

2010-02-19 Thread Erik Lewis
warnings; use strict; use LWP::Simple; print "Enter your address\n"; chomp (my $rawaddress = <>); my $geoaddress = $rawaddress =~ s/ /\+/; #strip the spaces from the address my $googlekey = "ABQIJKeZa28YtErALcrbEC0UlBREf5oWR6F07BQvSEe3pww8R4s0VhTfTt-19vTI9qA-_V1pUf4-_Tcf

Re: how do I replace all the spaces in a string with +

2010-02-19 Thread Sergey Matveev
Greetings, On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote: > I have to changes all the spaces in a string to +'s. Is there an easy way to > do this. The length of the string and the number of spaces will always be > changing. $string =~ s/ /\+/g; That is all. A

how do I replace all the spaces in a string with +

2010-02-19 Thread Erik Lewis
I have to changes all the spaces in a string to +'s. Is there an easy way to do this. The length of the string and the number of spaces will always be changing. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org

Re: Regexp to remove spaces

2009-12-29 Thread Dr.Ruud
sftriman wrote: Dr.Ruud: sub trim { ... }#trim You're missing the tr to squash space down To trim() is to remove from head and tail only. Just use it as an example to build a "trim_and_normalize()". So I think it can boil down to: sub fixsp7 { s#\A\s+##, s#\s+\z##, tr/ \t\n\r\f/ /

Re: Regexp to remove spaces

2009-12-28 Thread Shawn H Corey
sftriman wrote: > So I think it can boil down to: > > sub fixsp7 { > s#\A\s+##, s#\s+\z##, tr/ \t\n\r\f/ /s foreach @_; > return; > } sub fixsp7 { tr/ \t\n\r\f/ /s, s#\A\s##, s#\s\z## foreach @_; return; } Placing the tr/// first reduces the number of characters scanned for s#\s\z## which m

Re: Regexp to remove spaces

2009-12-28 Thread sftriman
On Dec 23, 2:31 am, rvtol+use...@isolution.nl (Dr.Ruud) wrote: > sftriman wrote: > > 1ST PLACE - THE WINNER:  5.0s average on 5 runs > > > # Limitation - pointer > > sub fixsp5 { > > ${$_[0]}=~tr/ \t\n\r\f/ /s; > > ${$_[0]}=~s/\A //; > > ${$_[0]}=~s/ \z//; > > } > > Just decide to change in-place,

Re: Regexp to remove spaces

2009-12-23 Thread Dr.Ruud
sftriman wrote: 1ST PLACE - THE WINNER: 5.0s average on 5 runs # Limitation - pointer sub fixsp5 { ${$_[0]}=~tr/ \t\n\r\f/ /s; ${$_[0]}=~s/\A //; ${$_[0]}=~s/ \z//; } Just decide to change in-place, based on the defined-ness of wantarray. sub trim { no warnings 'uninitialized'; if

Re: Regexp to remove spaces

2009-12-22 Thread sftriman
a 176 byte string for testing, and ran each method 1,000,000 times to time the speed. The winner is: 3 regexp, using tr for intra-string spaces. I found I could make this even faster using a pointer to the variable versus passing in the variable as a local input parameter, modifying, then returnin

Re: Regexp to remove spaces

2009-12-21 Thread Jim Gibson
At 6:11 PM +0800 12/21/09, Albert Q wrote: 2009/12/20 Dr.Ruud > > For a multi-line buffer you can do it like this: perl -wle ' my $x = <<"EOT"; 123456 \t abc def \t\t\t\t\t\t\t\t *** *** *** \t EOT s/^\s+//mg, s/\s+$//mg, s/[^\S\n]+/ /g for $x; I kno

Re: Regexp to remove spaces

2009-12-21 Thread Albert Q
h a single space. >> > > The g-modifier on the first 2 is bogus > (unless you would add an m-modifier). > > I currently tend to write it like this: > >s/\s+\z//, s/\A\s+//, s/\s+/ /g, for $x; > > So first remove tail spaces (less to lshift next). > Then remove

Re: Regexp to remove spaces

2009-12-21 Thread Dr.Ruud
Shawn H Corey wrote: $text =~ tr{\t}{ }; $text =~ tr{\n}{ }; $text =~ tr{\r}{ }; $text =~ tr{\f}{ }; $text =~ tr{ }{ }s; That can be written as: tr/\t\n\r\f/ /, tr/ / /s for $text; But it doesn't remove all leading nor all trailing spaces. -- Ruud -- To unsubscribe, e-mail: begi

Re: Regexp to remove spaces

2009-12-21 Thread Dr.Ruud
currently tend to write it like this: s/\s+\z//, s/\A\s+//, s/\s+/ /g, for $x; So first remove tail spaces (less to lshift next). Then remove head spaces. Then normalize. For a multi-line buffer you can do it like this: perl -wle ' my $x = <<"EOT"; 123456

Re: Regexp to remove spaces

2009-12-20 Thread Robert Wohlfarth
Basically, it's (1) remove all leading space, (2) remove all trailing > space, > and (3) replace all multi-space with a single space [which, at this > point, > should only occur on interior characters]. > Take a look at the String::Util module. The "crunch" function

Re: Regexp to remove spaces

2009-12-20 Thread Shawn H Corey
John W. Krahn wrote: > That can be reduced to: > > $text =~ tr/ \t\n\r\f/ /s; > > But that still doesn't remove leading and trailing whitespace so add two > more lines: > > $text =~ tr/ \t\n\r\f/ /s; > $text =~ s/\A //; > $text =~ s/ \z//; That was left as an exercise to the reader. Come now,

Re: Regexp to remove spaces

2009-12-20 Thread John W. Krahn
Shawn H Corey wrote: sftriman wrote: I use this series of regexp all over the place to clean up lines of text: $x=~s/^\s+//g; $x=~s/\s+$//g; $x=~s/\s+/ /g; in that order, and note the final one replace \s+ with a single space. Basically, it's (1) remove all leading space, (2) remove all trail

Re: Regexp to remove spaces

2009-12-20 Thread Shawn H Corey
sftriman wrote: > I use this series of regexp all over the place to clean up lines of > text: > > $x=~s/^\s+//g; > $x=~s/\s+$//g; > $x=~s/\s+/ /g; > > in that order, and note the final one replace \s+ with a single space. > > Basically, it's (1) remove all leading space, (2) remove all trailing

Re: Regexp to remove spaces

2009-12-20 Thread Erez Schatz
2009/12/20 sftriman : > I use this series of regexp all over the place to clean up lines of > text: > > $x=~s/^\s+//g; > $x=~s/\s+$//g; > $x=~s/\s+/ /g; > You can probably use $x=~s/^(\s+)|(\s+)$//g; But I don't think it will use any less CPU than the 3 regex option, the nature of Perl's regex en

Regexp to remove spaces

2009-12-20 Thread sftriman
I use this series of regexp all over the place to clean up lines of text: $x=~s/^\s+//g; $x=~s/\s+$//g; $x=~s/\s+/ /g; in that order, and note the final one replace \s+ with a single space. Basically, it's (1) remove all leading space, (2) remove all trailing space, and (3) replace all multi-spa

Re: Replace pattern with a variable num of spaces

2009-06-18 Thread John W. Krahn
Steve Bertrand wrote: John W. Krahn wrote: Steve Bertrand wrote: +sub is_word ($) { +return unless defined $_[0] && $_[0] ne ''; +return if $_[0] =~ /[\w\s]+/; +return 1; +} The other is_* functions in that module use anchors with their regular expressions so you probably should

Re: spaces in file name

2009-06-18 Thread Chas. Owens
On Thu, Jun 18, 2009 at 03:14, Irfan Sayed wrote: > Hi All, > > I am stuck on parsing file name if it has space. > I have file name as : file system.proj > now this file contains space between worf file and system > > now i want to do ceratin operation on this file > but whenever i give this file n

Re: spaces in file name

2009-06-18 Thread Steve Bertrand
Irfan Sayed wrote: > Hi All, > > I am stuck on parsing file name if it has space. > I have file name as : file system.proj > now this file contains space between worf file and system > > now i want to do ceratin operation on this file > but whenever i give this file name in any command then it

Re: Replace pattern with a variable num of spaces

2009-06-18 Thread Steve Bertrand
John W. Krahn wrote: > Steve Bertrand wrote: >> I wasted about two hours of my coding time trying to come up with a >> special JAPH, but I just haven't been able to make map() do what I think >> it should do ;) > > What did you think it should do? What did you want it to do? Originally, I was t

spaces in file name

2009-06-18 Thread Irfan Sayed
Hi All, I am stuck on parsing file name if it has space. I have file name as : file system.proj now this file contains space between worf file and system   now i want to do ceratin operation on this file but whenever i give this file name in any command then it fails saying that file does not ex

Re: Replace pattern with a variable num of spaces

2009-06-17 Thread John W. Krahn
Steve Bertrand wrote: John W. Krahn wrote: Steve Bertrand wrote: [ snip ] In the third line of the following code, I want the replacement pattern to be (whitespace * $_[1]). I'll deal with the undef issue after I figure out how to use {$num} on essentially nothing. I haven't been able to make

Re: Replace pattern with a variable num of spaces

2009-06-17 Thread Steve Bertrand
John W. Krahn wrote: > Steve Bertrand wrote: [ snip ] >> In the third line of the following code, I want the replacement pattern >> to be (whitespace * $_[1]). I'll deal with the undef issue after I >> figure out how to use {$num} on essentially nothing. I haven't been able >> to make it work with

Re: Replace pattern with a variable num of spaces

2009-06-17 Thread John W. Krahn
Steve Bertrand wrote: I'm attempting to write a patch for a module that I feel I can use within one of my own modules, and I've run into something that I can't solve (I can't come up with the proper query in Google). Perhaps code will help here. First, I know 'word' does not include whitespace,

Replace pattern with a variable num of spaces

2009-06-17 Thread Steve Bertrand
I'm attempting to write a patch for a module that I feel I can use within one of my own modules, and I've run into something that I can't solve (I can't come up with the proper query in Google). Perhaps code will help here. First, I know 'word' does not include whitespace, and I know that one shou

Re: substitute multiple spaces with just one

2008-11-04 Thread John W. Krahn
Mr. Shawn H. Corey wrote: On Tue, 2008-11-04 at 16:30 +0100, Rob Coops wrote: What you want to be doing is this: $temp =~ s/\s+/ /g; Actually to substitute multiple spaces with just one: $temp =~ s/ +/ /g; Or as some prefer: $temp =~ s{ [ ]+ }{ }gx; Not if speed is an issue: $ perl -le

Re: substitute multiple spaces with just one

2008-11-04 Thread John W. Krahn
Sharan Basappa wrote: Hi, Hello, I have string that has one or more spaces. I would like to replace them with a single space. $ perl -le' my $temp = "0 1 2 34"; print $temp; $temp =~ tr/ //s; print $temp; ' 0 1 2 34 0 1 2 3 4 The simple code below repl

Re: substitute multiple spaces with just one

2008-11-04 Thread Mr. Shawn H. Corey
On Tue, 2008-11-04 at 16:37 +0100, Rob Coops wrote: > On Tue, Nov 4, 2008 at 4:35 PM, Sharan Basappa <[EMAIL PROTECTED]>wrote: > > Thanks. BTW, a variable ($x = " ") instead of actual space would do, right? > > > > Yeah that should work just fine. It is better to call it $SPACE: my $SPACE = " ";

Re: substitute multiple spaces with just one

2008-11-04 Thread Mr. Shawn H. Corey
On Tue, 2008-11-04 at 16:30 +0100, Rob Coops wrote: > What you want to be doing is this: $temp =~ s/\s+/ /g; Actually to substitute multiple spaces with just one: $temp =~ s/ +/ /g; Or as some prefer: $temp =~ s{ [ ]+ }{ }gx; Or even: $temp =~ s/\x20+/\x20/g; The reason for not using

Re: substitute multiple spaces with just one

2008-11-04 Thread Rob Coops
On Tue, Nov 4, 2008 at 4:35 PM, Sharan Basappa <[EMAIL PROTECTED]>wrote: > > You are completely right. :-) > > > > What you want to be doing is this: $temp =~ s/\s+/ /g; > > The reason for that is simple, \s is used to match a space or multiple > > spaces, it

Re: substitute multiple spaces with just one

2008-11-04 Thread Sharan Basappa
> You are completely right. :-) > > What you want to be doing is this: $temp =~ s/\s+/ /g; > The reason for that is simple, \s is used to match a space or multiple > spaces, it is not used to print a space that is actually done by the ' ' > (space). It might seem a litt

Re: substitute multiple spaces with just one

2008-11-04 Thread Rob Coops
On Tue, Nov 4, 2008 at 4:21 PM, Sharan Basappa <[EMAIL PROTECTED]>wrote: > Hi, > > I have string that has one or more spaces. I would like to replace > them with a single space. > The simple code below replaces the spaces fine, but does not > substitute with a space. >

substitute multiple spaces with just one

2008-11-04 Thread Sharan Basappa
Hi, I have string that has one or more spaces. I would like to replace them with a single space. The simple code below replaces the spaces fine, but does not substitute with a space. $temp = "0 1 2 34"; <-> version 1 $temp =~ s/\s+/\s/g; $temp = "0 1 2 34&

Re: Stripping the beginning of a line of spaces

2008-10-11 Thread John W. Krahn
AndrewMcHorney wrote: Hello Hello, I am working on a script that does a directory of a Windows drive. There are some lines returned where there are spaces before the 1st character. If it's the first character then by definition it can't have anything before it. This thro

Re: Stripping the beginning of a line of spaces

2008-10-11 Thread AndrewMcHorney
, AndrewMcHorney wrote: > Hello > > I am working on a script that does a directory of a Windows drive. > There are some lines returned where there are spaces before the 1st > character. This throws off the splitting of the line into an array. > How can I strip the leading characters in an

Re: Stripping the beginning of a line of spaces

2008-10-11 Thread Mr. Shawn H. Corey
On Sat, 2008-10-11 at 16:58 -0700, AndrewMcHorney wrote: > Hello > > I am working on a script that does a directory of a Windows drive. > There are some lines returned where there are spaces before the 1st > character. This throws off the splitting of the line into an array. &g

Stripping the beginning of a line of spaces

2008-10-11 Thread AndrewMcHorney
Hello I am working on a script that does a directory of a Windows drive. There are some lines returned where there are spaces before the 1st character. This throws off the splitting of the line into an array. How can I strip the leading characters in an efficient way into either the same

Re: using regex, how to erase off all blank spaces

2008-04-06 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > use strict; > use warnings; > > open (MYDATAS , " my @datas = ; > close MYDATAS; > > foreach (@datas){ > s/^\s*$//; > } > > open (WRITEDATAS, ">testing.txt") || die $!; > print WRITEDATAS @datas; > close WRITEDATAS; That looks a lot like Perl 4. Study this: #!/usr

Re: using regex, how to erase off all blank spaces

2008-04-05 Thread Jeff Pang
On Sun, Apr 6, 2008 at 11:17 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: > > Your problem is that the line "123\n" does not match the pattern /^\s*$/. > Try it using two substitutions like this: > > s/^\s+//; > > s/\s+$//; or use one, s/^\s+|\s+$//g; -- To unsubscribe, e-mail: [EMAIL

Re: using regex, how to erase off all blank spaces

2008-04-05 Thread John W. Krahn
newlines in the file except the last newline. So how do I construct a regex to erase off all the spaces including new lines. Is this correct and is this the only way [\n\s\t]+ Thanks ### start of script# # testing.txt look below use strict; use warnings; open

using regex, how to erase off all blank spaces

2008-04-05 Thread itshardtogetone
newline. So how do I construct a regex to erase off all the spaces including new lines. Is this correct and is this the only way [\n\s\t]+ Thanks ### start of script# # testing.txt look below use strict; use warnings; open (MYDATAS , "; close MY

Re: Problem with spaces in paths

2008-02-21 Thread jshock
Thanks John and Gunnar. It's working now. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Problem with spaces in paths

2008-02-20 Thread Gunnar Hjalmarsson
jshock wrote: @source = qw( "/Users/joe/Documents/Palm/" "/Users/joe/Library/Application\ Support/AddressBook" "/Users/joe/Library/Application\ Support/iCal" "/Users/joe/Library/Mail" ); That code does probably not do what you want. Besides the space problem, t

Re: Problem with spaces in paths

2008-02-20 Thread John W. Krahn
jshock wrote: I have written a simple script that uses rsync to backup directories to a USB drive. The directories are selected from an array. The problem I am having is that if the directory has a space in it, the script breaks. I have tried putting backslashed in front of the spaces, and

Problem with spaces in paths

2008-02-20 Thread jshock
I have written a simple script that uses rsync to backup directories to a USB drive. The directories are selected from an array. The problem I am having is that if the directory has a space in it, the script breaks. I have tried putting backslashed in front of the spaces, and encasing the entire

Re: qw with strings containing spaces

2007-08-09 Thread usenet
On Aug 9, 11:58 am, [EMAIL PROTECTED] (Mathew Snyder) wrote: > What I am doing is declaring an array and assigning the value: > @array = qw/All "A - H" "I - P" "Q - Z"/; You don't want qw{} here. Just do it the brute-force way: @array = ("All", "A - H", "I - P", "Q - Z"); -- The best way to

Re: qw with strings containing spaces

2007-08-09 Thread Mathew Snyder
t;A - H", "I - P" and "Q - Z". >> The spaces >> are for readability. >> >> What I am doing is declaring an array and assigning the value: >> @array = qw/All "A - H" "I - P" "Q - Z"/; >> and then pushing the to-be-

Re: qw with strings containing spaces

2007-08-09 Thread John W. Krahn
Mathew Snyder wrote: I need to populate a select multiple on a web page when it loads with a series of values. Most of the values will be determined dynamically when the code runs but some are static. They look like "A - H", "I - P" and "Q - Z". The spaces a

Re: qw with strings containing spaces

2007-08-09 Thread Flemming Greve Skovengaard
Mathew Snyder wrote: I need to populate a select multiple on a web page when it loads with a series of values. Most of the values will be determined dynamically when the code runs but some are static. They look like "A - H", "I - P" and "Q - Z". The spaces a

qw with strings containing spaces

2007-08-09 Thread Mathew Snyder
I need to populate a select multiple on a web page when it loads with a series of values. Most of the values will be determined dynamically when the code runs but some are static. They look like "A - H", "I - P" and "Q - Z". The spaces are for readability. What I

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread John W. Krahn
Chas Owens wrote: > On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote: >> On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote: >> snip >> > my $tidy = "/usr/bin/tidy"; >> > my @tidy_args = qw(--foo --bar -- example); >> > my $path = get_path(); >> > my $file = $path . get_file(); >> > >> > system($tidy,

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Okay, I eliminated the tidy with some more robust regex. D'oh! Case closed! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip > my $tidy = "/usr/bin/tidy"; > my @tidy_args = qw(--foo --bar -- example); > my $path = get_path(); > my $file = $path . get_file(); > > system($tidy, @tidy_args, $file); Opps, forgot the erro

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip my $tidy = "/usr/bin/tidy"; my @tidy_args = qw(--foo --bar -- example); my $path = get_path(); my $file = $path . get_file(); system($tidy, @tidy_args, $file); Opps, forgot the error checking. system($tidy, @tidy_args, $file) or die qq(

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote: snip Then I attempted to use Tidy, sans HTML::Tidy, through Shell. The HTML::Tidy lib won't work on my system. So, I have been futzing with tidy and I'v e discovered that tidy and simple commands like cd fail, most likely because

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
On Jun 3, 2007, at 1:59 PM, Chas Owens wrote: On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote: snip I have to assume that paths can be converted easily for use in shells and such, without resorting to RegEx. Any ideas? snip Aside from the multi argument version of system that Tom has alread

Fwd: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Begin forwarded message: From: Mike Lesser <[EMAIL PROTECTED]> Date: June 3, 2007 3:48:56 PM EDT To: "Chas Owens" <[EMAIL PROTECTED]> Subject: Re: Paths, Spaces, Getopt::Long On Jun 3, 2007, at 1:59 PM, Chas Owens wrote: On 6/3/07, Mike Lesser <[EMAIL PROTECTED

Fwd: Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Well I'm not sure. I may be explaining this badly. I'll go thru all the details in case it helps. The path I pass when I'm executing the script is escaped, which I assume is correct. Once that path is read by Getopt, I print it and, voila, no escapes, just nice-to-read

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Chas Owens
On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote: snip I have to assume that paths can be converted easily for use in shells and such, without resorting to RegEx. Any ideas? snip Aside from the multi argument version of system that Tom has already mentioned, the bigger question is "Why are you

Re: Paths, Spaces, Getopt::Long

2007-06-03 Thread Tom Phoenix
On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote: I use the module Getopt::Long to read arguments, one of which is a file path that may have spaces. The path string that is returned from Getopt has spaces without escape chars. The string seems to be fine for Perl use, but not so gre

Paths, Spaces, Getopt::Long

2007-06-03 Thread Mike Lesser
Hi all. I have a problem that _must_ have a very simple solution (that I can't find). I use the module Getopt::Long to read arguments, one of which is a file path that may have spaces. The path string that is returned from Getopt has spaces without escape chars. The string seems

Re: Regexp non-alphanumerics to spaces

2007-03-31 Thread Dr.Ruud
"John W. Krahn" schreef: > Dr.Ruud: >> John W. Krahn: >>> Rob Dixon: >>>> Grant: >>>>> Hello, can you guys show me how to convert each non-alphanumeric >>>>> character in a string to a space, and then convert any number of >

Re: Regexp non-alphanumerics to spaces

2007-03-30 Thread John W. Krahn
Dr.Ruud wrote: > "John W. Krahn" schreef: >>Rob Dixon: >>>Grant: > >>>>Hello, can you guys show me how to convert each non-alphanumeric >>>>character in a string to a space, and then convert any number of >>>>consecutive spa

Re: Regexp non-alphanumerics to spaces

2007-03-30 Thread Dr.Ruud
"John W. Krahn" schreef: > Rob Dixon: >> Grant: >>> Hello, can you guys show me how to convert each non-alphanumeric >>> character in a string to a space, and then convert any number of >>> consecutive spaces in the string to a single space? >&g

Re: Regexp non-alphanumerics to spaces

2007-03-30 Thread John W. Krahn
Rob Dixon wrote: > Grant wrote: >> >> Hello, can you guys show me how to convert each non-alphanumeric >> character in a string to a space, and then convert any number of >> consecutive spaces in the string to a single space? >> >> If I need to specify exact

Re: Regexp non-alphanumerics to spaces

2007-03-30 Thread Grant
> Hello, can you guys show me how to convert each non-alphanumeric > character in a string to a space, and then convert any number of > consecutive spaces in the string to a single space? > > If I need to specify exactly which characters I want converted to > spaces, I'd

Re: Regexp non-alphanumerics to spaces

2007-03-30 Thread Rob Dixon
Grant wrote: Hello, can you guys show me how to convert each non-alphanumeric character in a string to a space, and then convert any number of consecutive spaces in the string to a single space? If I need to specify exactly which characters I want converted to spaces, I'd be happy with

Regexp non-alphanumerics to spaces

2007-03-30 Thread Grant
Hello, can you guys show me how to convert each non-alphanumeric character in a string to a space, and then convert any number of consecutive spaces in the string to a single space? If I need to specify exactly which characters I want converted to spaces, I'd be happy with just the ".&

Re: substitute all spaces in a sentence except spaces in the first three words

2007-01-19 Thread John W. Krahn
Michael Alipio wrote: > Hi, Hello, > Suppose I have: > > my $sentence = 'the quick brown fox jumps over the lazy dog." > > Now I want it to become: > > 'the quick brown:fox:jumps:over:the lazy dog." One way to do it: $ perl -le' my $sentence = "the quick brown fox jumps over the lazy dog.";

Re: substitute all spaces in a sentence except spaces in the first three words

2007-01-19 Thread Rob Dixon
Michael Alipio wrote: Suppose I have: my $sentence = 'the quick brown fox jumps over the lazy dog." Now I want it to become: 'the quick brown:fox:jumps:over:the lazy dog." That is, to replace the spaces between brown-fox, fox-jumps, jumps-over, over-the, with "

substitute all spaces in a sentence except spaces in the first three words

2007-01-19 Thread Michael Alipio
Hi, Suppose I have: my $sentence = 'the quick brown fox jumps over the lazy dog." Now I want it to become: 'the quick brown:fox:jumps:over:the lazy dog." That is, to replace the spaces between brown-fox, fox-jumps, jumps-over, over-the, with ":". Should I spli

RE: How to ignore spaces in directory names?

2006-07-13 Thread Timothy Johnson
Just to clarify: the double-quotes should go around the argument on the command-line, not the variable in Perl. -Original Message- From: Timothy Johnson Sent: Thursday, July 13, 2006 11:47 AM To: Nishi Bhonsle; beginners perl Subject: RE: How to ignore spaces in directory names? Put

RE: How to ignore spaces in directory names?

2006-07-13 Thread Timothy Johnson
1:44 AM To: beginners perl Subject: How to ignore spaces in directory names? Hi: In writing a perl script to read the contents of a directory on a windows system, i noticed that there are some directory names have spaces in them. How can I modify the line below so it would ignore the spaces in the

How to ignore spaces in directory names?

2006-07-13 Thread Nishi Bhonsle
Hi: In writing a perl script to read the contents of a directory on a windows system, i noticed that there are some directory names have spaces in them. How can I modify the line below so it would ignore the spaces in the directory name and still process it ? opendir DIR, $path or die "

Re: Glob with spaces

2006-01-25 Thread Chas Owens
On 1/25/06, DiGregorio, Dave <[EMAIL PROTECTED]> wrote: > Is there a way to glob if the directory path has spaces? > > The following does not work > > $sourcePath = "C:/Documents and Settings/xyz/abc ; > > files = glob $sourcePath ; This seems to work: my @f

Glob with spaces

2006-01-25 Thread DiGregorio, Dave
Is there a way to glob if the directory path has spaces? The following does not work $sourcePath = "C:/Documents and Settings/xyz/abc ; files = glob $sourcePath ; Thanks David R. DiGregorio Vocollect 703 Rodi Road Pittsburgh, PA 15235 P. 412-349-2440 [EMAIL PROT

Re: number of spaces in a given sentence using regular expression.

2005-11-23 Thread Chris Devers
On Tue, 22 Nov 2005, Bob Showalter wrote: > [EMAIL PROTECTED] wrote: > > ... > > please give me the answers of these questions. > > Chris Devers will be along shortly... :~) Sorry, I was on vacation :-) Please, in the future, direct all such questions to [EMAIL PROTECTED] (You'll probabl

Re: number of spaces in a given sentence using regular expression.

2005-11-22 Thread Paul Johnson
On Tue, Nov 22, 2005 at 10:36:49PM +, [EMAIL PROTECTED] wrote: > SET A > 1. Write a perl script to find the number of spaces in a given sentence > using regular expression. > please give me the answers of these questions. I only have time to do this one for now. Maybe ot

Re: number of spaces in a given sentence using regular expression.

2005-11-22 Thread Bob Showalter
[EMAIL PROTECTED] wrote: ... please give me the answers of these questions. Chris Devers will be along shortly... :~) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: number of spaces in a given sentence using regular expression.

2005-11-22 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: SET A 1. Write a perl script to find the number of spaces in a given sentence using regular expression. 2. Write a perl script to take name from command line argument and print the inputted name in both lower case and upper case. (use functions) 3

RE: number of spaces in a given sentence using regular expression.

2005-11-22 Thread Timothy Johnson
No. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 22, 2005 2:37 PM To: beginners@perl.org Subject: number of spaces in a given sentence using regular expression. SET A 1. Write a perl script to find the number of spaces in a

number of spaces in a given sentence using regular expression.

2005-11-22 Thread [EMAIL PROTECTED]
SET A 1. Write a perl script to find the number of spaces in a given sentence using regular expression. 2. Write a perl script to take name from command line argument and print the inputted name in both lower case and upper case. (use functions) 3. Write a perl script to

Re: passing arguments with white spaces

2005-07-04 Thread Ing. Branislav Gerzo
lohit [l], on Monday, July 4, 2005 at 13:21 (+0530) contributed this to our collective wisdom: l> lets assume I call the function as show below l> func("arg1","arg2","this is arg 3", "this is arg 4"); l> now inside func function how do I retrieve my arguments l> sub func() l> { l> foreach $arg

Re: passing arguments with white spaces

2005-07-04 Thread John Doe
lohit am Montag, 4. Juli 2005 09.51: > lets assume I call the function as show below > func("arg1","arg2","this is arg 3", "this is arg 4"); > now inside func function how do I retrieve my arguments > sub func() > { > foreach $arg in (@ARGV) { > print "$arg\n"; > } > } > this would print > arg1

  1   2   3   4   >