improved
automatically since you love it.
-Original Message-
From: Shlomi Fish [mailto:shlo...@shlomifish.org]
Sent: 13 July 2012 17:00
To: Nemana, Satya
Cc: beginners@perl.org
Subject: Re: one liner for removing string from an element of string array
Hi Satya,
On Fri, 13 Jul 2012 15:38:20
On 12-07-13 12:32 PM, Uri Guttman wrote:
On 07/13/2012 12:27 PM, Shawn H Corey wrote:
On 12-07-13 11:59 AM, Shlomi Fish wrote:
See File::Basename -http://perldoc.perl.org/File/Basename.html . In the
future, you may wish to use regular expressions for similar task
There are a number of modules
On 12-07-13 12:32 PM, Uri Guttman wrote:
On 07/13/2012 12:27 PM, Shawn H Corey wrote:
On 12-07-13 11:59 AM, Shlomi Fish wrote:
See File::Basename -http://perldoc.perl.org/File/Basename.html . In the
future, you may wish to use regular expressions for similar task
There are a number of modules
On 07/13/2012 12:27 PM, Shawn H Corey wrote:
On 12-07-13 11:59 AM, Shlomi Fish wrote:
See File::Basename -http://perldoc.perl.org/File/Basename.html . In the
future, you may wish to use regular expressions for similar task
There are a number of modules installed with Perl that make working wit
On 12-07-13 11:59 AM, Shlomi Fish wrote:
See File::Basename -http://perldoc.perl.org/File/Basename.html . In the
future, you may wish to use regular expressions for similar task
There are a number of modules installed with Perl that make working with
file systems easier:
perldoc File::Basen
Hi Satya,
On Fri, 13 Jul 2012 15:38:20 +
"Nemana, Satya" wrote:
> Hi
>
> I have written a small program like this to just print file2 from the second
> element of the array by removing the .template from the entry (the name file2
> can change and can be longer or shorter)
>
> use strict;
Nemana, Satya wrote:
> Hi
>
> I have written a small program like this to just print file2 from the
> second element of the array by removing the .template from the entry (the
> name file2 can change and can be longer or shorter)
>
> use strict;
> use Data::Dumper;
> use warnings;
>
> my @templates
> -Original Message-
> From: Shawn H. Corey [mailto:shawnhco...@gmail.com]
> Sent: Monday, August 24, 2009 11:57
> To: Wagner, David --- Senior Programmer Analyst --- CFS
> Cc: Tony Esposito; Beginners Perl
> Subject: Re: one liner in Windows to replace string
> -Original Message-
> From: Shawn H. Corey [mailto:shawnhco...@gmail.com]
> Sent: Monday, August 24, 2009 11:00
> To: Tony Esposito
> Cc: Beginners Perl
> Subject: Re: one liner in Windows to replace string
>
> Tony Esposito wrote:
> > perl -p -i.b
From: Tony Esposito [mailto:tony1234567...@yahoo.co.uk]
Sent: Monday, August 24, 2009 14:09
To: Shawn H. Corey
Cc: Wagner, David --- Senior Programmer Analyst --- CFS;
Beginners Perl
Subject: Re: one liner in Windows to
From: Tony Esposito [mailto:tony1234567...@yahoo.co.uk]
Sent: Monday, August 24, 2009 13:20
To: Shawn H. Corey; Wagner, David --- Senior Programmer Analyst
--- CFS
Cc: Beginners Perl
Subject: Re: one liner in Windows to
> -Original Message-
> From: Tony Esposito [mailto:tony1234567...@yahoo.co.uk]
> Sent: Monday, August 24, 2009 10:46
> To: Beginners Perl
> Cc: tony1234567...@yahoo.co.uk
> Subject: one liner in Windows to replace string
>
> perl -p -i.bak -e 's/CONSTANT/VARIABLE/' C:\test.txt
>
Telemachus wrote:
Ok, not to be a jerk, but look at it this way: it's clear that Windows +
one-liners are not going well. In the time we've all gone back and forth on
this, you could have written a 10 line script and run it about 20 times.
Pick your battles, I say.
True, but it means "A Poor
On Mon Aug 24 2009 @ 8:08, Tony Esposito wrote:
> Looks good but it bombs ... the Perl interpreter crashes from the DOS prompt
> ... using version 5.10.0 build 1005 from ActiveState.
>
> But it was better than what I had, that's for sure
>
> This makes for a bit of a mind teaser thanks to it be
ndoze ... :-)
From: Shawn H. Corey
To: Tony Esposito
Cc: "Wagner, David --- Senior Programmer Analyst --- CFS"
; Beginners Perl
Sent: Monday, 24 August, 2009 14:49:47
Subject: Re: one liner in Windows to replace string
Tony Esposito wrote:
> I am happy that it works with double quotes BUT
x27;)" #
does not work -- compilation error ...
??
From: Bob McConnell
To: Tony Esposito ; Shawn H. Corey
; "Wagner, David --- Senior Programmer Analyst --- CFS"
Cc: Beginners Perl
Sent: Monday, 24 August, 2009 14:39:57
Subject: RE: one liner in Windows to replace s
Tony Esposito wrote:
I am happy that it works with double quotes BUT now, when I try to get
all files in a directory with a certain extension, the following does
not work ...
perl -p -i.bak -e "'s/CONSTANT/VARIABLE/'" C:\***.txt
does not like th leading * in the file name when I try to pull
. Corey; Wagner, David --- Senior Programmer Analyst --- CFS
Cc: Beginners Perl
Subject: Re: one liner in Windows to replace string
I am happy that it works with double quotes BUT now, when I try to get all
files in a directory with a certain extension, the following does not work ...
perl -p -i.bak
txt files
...
Help again.
From: Shawn H. Corey
To: "Wagner, David --- Senior Programmer Analyst --- CFS"
Cc: Tony Esposito ; Beginners Perl
Sent: Monday, 24 August, 2009 12:57:27
Subject: Re: one liner in Windows to replace string
Wagner, David
Wagner, David --- Senior Programmer Analyst --- CFS wrote:
I ran under windows with what Tony sent, both the cmd and a korn
shell and both worked and updated as expected..
If you have any questions and/or problems, please let me know.
Thanks.
What version of Windows?
On Mon Aug 24 2009 @ 4:45, Tony Esposito wrote:
> perl -p -i.bak -e 's/CONSTANT/VARIABLE/' C:\test.txt
>
> Trying to replace a string with this one line perl ... in Windows it does not
> seem to work ...
>
> File test.txt contents is ...
>
> CONSTANT 100
> CONSTANT 200
>
> nothing changes ...
Tony Esposito wrote:
perl -p -i.bak -e 's/CONSTANT/VARIABLE/' C:\test.txt
Trying to replace a string with this one line perl ... in Windows it does not
seem to work ...
File test.txt contents is ...
CONSTANT 100
CONSTANT 200
nothing changes ... acts as if it does not 'see' the CONSTANT strin
On Fri, Mar 13, 2009 at 01:13:38PM +1100, Toby Stuart wrote:
> Hello All
>
> It's been almost 13 years since I last posted on this board
Not to *this* one.
> PS. Where is $Bill? Is he still around?
Ah, *that* one.
That was a long time ago in a galaxy far, far away.
--
Paul Johnson - p...@
John W. Krahn wrote:
John W. Krahn wrote:
Toby Stuart wrote:
Hello All
Hello,
It's been almost 13 years since I last posted on this board and my
Perl skills are extremely rusty. Could someone help me to convert
this to a one liner:-
use strict;
use warnings;
while (<>) {
/^##\s*(.*)$/
John W. Krahn wrote:
Toby Stuart wrote:
Hello All
Hello,
It's been almost 13 years since I last posted on this board and my
Perl skills are extremely rusty. Could someone help me to convert
this to a one liner:-
use strict;
use warnings;
while (<>) {
/^##\s*(.*)$/ && print $1;
print "
Toby Stuart wrote:
Hello All
Hello,
It's been almost 13 years since I last posted on this board and my
Perl skills are extremely rusty. Could someone help me to convert
this to a one liner:-
use strict;
use warnings;
while (<>) {
/^##\s*(.*)$/ && print $1;
print " && " unless eof;
}
I
Great. Thankyou chenxy.
-Original Message-
From: chenxy [mailto:tin...@gmail.com]
Sent: Friday, 13 March 2009 2:01 PM
To: Toby Stuart
Cc: beginners@perl.org
Subject: Re: one liner need help
2009/3/13 Toby Stuart < toby.stu...@figtreesys.com.au>
Hello All
It's been almo
2009/3/13 Toby Stuart
> Hello All
>
> It's been almost 13 years since I last posted on this board and my Perl
> skills are extremely rusty. Could someone help me to convert this to a one
> liner:-
>
>
> use strict;
> use warnings;
>
> while (<>) {
> /^##\s*(.*)$/ && print $1;
> print " && " un
On Fri, Nov 28, 2008 at 22:21, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Chas. Owens wrote:
>>
>> On Fri, Nov 28, 2008 at 10:28, John W. Krahn <[EMAIL PROTECTED]> wrote:
>> snip
>>>
>>> perl -le'@chars = 33 .. 126; print map chr $chars[ rand @chars ], 1 .. 8'
>>
>> snip
>>
>> Perl Golf time:
>>
>>
Chas. Owens wrote:
On Fri, Nov 28, 2008 at 10:28, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
perl -le'@chars = 33 .. 126; print map chr $chars[ rand @chars ], 1 .. 8'
snip
Perl Golf time:
perl -le'print map chr+(33..126)[rand 94],1..8'
$ perl -le'print map chr+(33..126)[rand 94],1..8'
Wa
On Fri, Nov 28, 2008 at 10:28, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> perl -le'@chars = 33 .. 126; print map chr $chars[ rand @chars ], 1 .. 8'
snip
Perl Golf time:
perl -le'print map chr+(33..126)[rand 94],1..8'
--
Chas. Owens
wonkden.net
The most important skill a programmer can have
On Thu, Nov 27, 2008 at 15:04, Yimin Rong <[EMAIL PROTECTED]> wrote:
> wget -q -O - "http://random.org/integers/?
> num=8&min=33&max=126&col=8&base=16&format=plain&rnd=new" | perl -ne
> 'foreach (split(/\t/, $_)) {print chr(hex($_));} print "\n"'
>
> wget reads web pages
> random.org generates rand
Yimin Rong wrote:
wget -q -O - "http://random.org/integers/?
num=8&min=33&max=126&col=8&base=16&format=plain&rnd=new" | perl -ne
'foreach (split(/\t/, $_)) {print chr(hex($_));} print "\n"'
You can simplify the perl part to:
perl -lane'print map chr hex, @F'
Or just using perl:
perl -MLWP::
[EMAIL PROTECTED] wrote:
Here's a string in my file,
#define MY2D_STRING"4.0.1.999.9"
of which I'm trying to increment the last digit; let's say with 1,
such that the output is 4.0.1.999.10
I've tried _various_ combinations, here's just one of them.
(This works partially, but not
On Fri, 2008-09-19 at 20:53 -0700, [EMAIL PROTECTED] wrote:
> Here's a string in my file,
>
> #define MY2D_STRING"4.0.1.999.9"
>
> of which I'm trying to increment the last digit; let's say with 1,
>
> such that the output is 4.0.1.999.10
>
> I've tried _various_ combinations, here'
On Sat, Jun 14, 2008 at 1:05 PM, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
> From: "Xavier Noria" <[EMAIL PROTECTED]>> On Sat, Jun 14, 2008 at 9:56 AM,
> Octavian Rasnita <[EMAIL PROTECTED]> wrote:
>>
>>> Is there a one-liner command that can replace a certain text with another
>>> in
>>> more f
From: "Xavier Noria" <[EMAIL PROTECTED]>> On Sat, Jun 14, 2008 at 9:56 AM,
Octavian Rasnita <[EMAIL PROTECTED]> wrote:
Is there a one-liner command that can replace a certain text with another
in
more files specified with wildcards like *.html that works under Windows
cmd?
Since you ask this
On Sat, Jun 14, 2008 at 9:56 AM, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
> Is there a one-liner command that can replace a certain text with another in
> more files specified with wildcards like *.html that works under Windows
> cmd?
Since you ask this you probably know the Windows shell does
Rob Dixon wrote:
Richard Lee wrote:
#!/usr/bin/perl
use warnings;
use strict;
my @array = qw/one two three four/;
print "$_\n" for @array last if "$_" eq q/three/;
[EMAIL PROTECTED] tmp]# ./!$
././././testthis2.pl
syntax error at ././././testthis2.pl line 8, near "@array last "
Execution
Yitzchok Good wrote:
>
> if ("$_" eq q/three/) {print "$_\n" for @array last};
That won't even compile. Please don't publish nonsense.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Richard Lee wrote:
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> my @array = qw/one two three four/;
>
> print "$_\n" for @array last if "$_" eq q/three/;
>
>
> [EMAIL PROTECTED] tmp]# ./!$
> ././././testthis2.pl
> syntax error at ././././testthis2.pl line 8, near "@array last "
> Exec
if ("$_" eq q/three/) {print "$_\n" for @array last};
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
> "Robert" == Robert Leibl <[EMAIL PROTECTED]> writes:
Robert> Dermot wrote:
>> Hi,
>>
>> ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh
>>
>>
>> I concocted the above command to change files named
>>
>> A1234. to A1234.jpg
>>
>> Is there a pure perl one-liner for this?
Dermot wrote:
Hi,
Hello,
ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh
I concocted the above command to change files named
A1234. to A1234.jpg
Is there a pure perl one-liner for this? Just curious.
perl -e'rename$_,"${_}jpg"or warn"$_: $!"for<*.>'
John
--
Perl isn'
Dermot wrote:
> Hi,
>
> ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh
>
>
> I concocted the above command to change files named
>
> A1234. to A1234.jpg
>
> Is there a pure perl one-liner for this? Just curious.
>
> Thanx,
> Dp.
>
perl -e 'rename $_, $_."jpg" foreach (glob
On 8/16/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> The object created by qr// *is* a compiled regex:
snip
Yeah my bad, the stringification confused me for a minute.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Chas Owens wrote:
qr// is just a fancy double
quote that adds a non-capturing group and sets the appropriate options
(in case you did something like qr/foo/i). The string "(?:-xism:foo)"
is no more or less a regex than the string "foo".
Let's look into that.
C:\home>type test.pl
$re1 = '(?i-x
Chas Owens wrote:
On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
snip
Silly rhetorical-ness aside, you seem unfamiliar with the term you
introduced to this thread: "string form of a regexp":
$ perl -le'
$a = q{foo};
$b = qr{foo};
print $a;
print $b;
'
foo
(?-xism:foo)
My assertion is that y
On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
snip
> Silly rhetorical-ness aside, you seem unfamiliar with the term you
> introduced to this thread: "string form of a regexp":
>
> $ perl -le'
> $a = q{foo};
> $b = qr{foo};
> print $a;
> print $b;
> '
> foo
> (?-xism:foo)
>
> My assertion is tha
On Aug 16, 10:19 am, [EMAIL PROTECTED] (Chas Owens) wrote:
> On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
>
> > On Aug 16, 5:12 am, [EMAIL PROTECTED] (Chas Owens) wrote:
> > > Basically
> > > it all comes down to this: always use quotemeta unless the variable is
> > > known to contain the stri
On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
> On Aug 16, 5:12 am, [EMAIL PROTECTED] (Chas Owens) wrote:
> > Basically
> > it all comes down to this: always use quotemeta unless the variable is
> > known to contain the string form of a regex.
>
> No. It comes down to: "always use quotemeta un
On Aug 16, 5:12 am, [EMAIL PROTECTED] (Chas Owens) wrote:
> Basically
> it all comes down to this: always use quotemeta unless the variable is
> known to contain the string form of a regex.
No. It comes down to: "always use quotemeta unless the variable is
known to contain the string form of a re
On Aug 16, 4:37 am, [EMAIL PROTECTED] (Dr.Ruud) wrote:
> Paul Lalli schreef:
>
> > s/$h1_sec/$mod_sec/; #replace the pattern found with the
> > modified version
>
> Many s/$search/replace/ constructs should have been written with
> quotemeta, so that they look like:
>
> s/\Q${search}/repl
Apologies I miss read the original remark.
-Original Message-
From: Chas Owens [mailto:[EMAIL PROTECTED]
Sent: 16 August 2007 10:12
To: Andrew Curry
Cc: Dr.Ruud; beginners@perl.org
Subject: Re: One liner to change one line
On 8/16/07, Andrew Curry <[EMAIL PROTECTED]> wrote
On 8/16/07, Andrew Curry <[EMAIL PROTECTED]> wrote:
snip
>> Many s/$search/replace/ constructs should have been written with quotemeta,
>> so that they look like:
>>
>> s/\Q${search}/replace/
snip
> Why?
snip
given
my $search = "file.txt";
What do you want matched? Without the quotemeta it
Why?
-Original Message-
From: Dr.Ruud [mailto:[EMAIL PROTECTED]
Sent: 16 August 2007 09:37
To: beginners@perl.org
Subject: Re: One liner to change one line
Paul Lalli schreef:
> s/$h1_sec/$mod_sec/; #replace the pattern found with the
> modified version
Many s/$search/r
Paul Lalli schreef:
> s/$h1_sec/$mod_sec/; #replace the pattern found with the
> modified version
Many s/$search/replace/ constructs should have been written with
quotemeta, so that they look like:
s/\Q${search}/replace/
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe,
On Aug 15, 2007, at 7:04 PM, Xavier Noria wrote:
perl -0777 -pi.bak -we 's{()(.*?)()}{$x = $2; $x =~
tr:-: :; "$1$x$3"}geis' *.html
A small improvement, groups are unnecessary because the elements are
guaranteed not to have hyphens (in general they could, for instance
in a class name, b
On Aug 15, 12:45 pm, [EMAIL PROTECTED] (Dennis G. Wicks) wrote:
> Greetings;
>
> I have, conservatively, dozens of html files to change.
>
> I can find them and pass the file name to perl and
> do the usual s/// changes but there is one change I can't
> figure out.
>
> There is a line in each file
On Aug 15, 2007, at 6:45 PM, Dennis G. Wicks wrote:
Greetings;
I have, conservatively, dozens of html files to change.
I can find them and pass the file name to perl and
do the usual s/// changes but there is one change I can't
figure out.
There is a line in each file that looks like
Th
On 9/25/06, Michael Alipio <[EMAIL PROTECTED]> wrote:
I have several files with \xa0 characters.. Do you
know how can I remove them?
Those sound like non-breaking spaces, so you probably want them to
become ordinary spaces. Have you tried using s/// or tr/// ?
perl -pi.bak -e 'tr/\xa0/ /'
Peter Scott wrote:
> On Wed, 17 May 2006 10:57:44 -0400, Zembower, Kevin wrote:
>>I tried to combine them into this:
>>
>>perl -ne 'print unless $seen{s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
>>.*/$1/}++' access.log
>>
>>but it just returns the first entry of the file.
>
> And the problem with tha
On Wed, 17 May 2006 10:57:44 -0400, Zembower, Kevin wrote:
> I tried to combine them into this:
>
> perl -ne 'print unless $seen{s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
> .*/$1/}++' access.log
>
> but it just returns the first entry of the file.
And the problem with that is that in a scalar con
EMAIL PROTECTED]
Sent: Wednesday, May 17, 2006 4:12 PM
To: Perl Beginners
Subject: Re: One liner to return unique IPs from web log?
Zembower, Kevin wrote:
> I'm trying to write a perl one-liner to return the unique IP addresses
> from a Apache web log, like this:
>
> perl -
not it's
an IP address or domain name.
Thanks, again, for your help.
-Kevin
-Original Message-
From: Jaime Murillo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 17, 2006 4:08 PM
To: beginners@perl.org
Subject: Re: One liner to return unique IPs from web log?
On Wednesday 17 May
Zembower, Kevin wrote:
> I'm trying to write a perl one-liner to return the unique IP addresses
> from a Apache web log, like this:
>
> perl -ne 'print if s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) .*/$1/'
> access.log | nawk '!x[$0]++'
perl -lne'/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) / && !$x{$1}++
On Wednesday 17 May 2006 07:57, Zembower, Kevin wrote:
> I'm trying to write a perl one-liner to return the unique IP addresses
> from a Apache web log, like this:
>
> perl -ne 'print if s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) .*/$1/'
> access.log | nawk '!x[$0]++'
>
> I tried to combine it with th
On Wed, 2006-05-17 at 10:57 -0400, Zembower, Kevin wrote:
> Any advice on correcting my script? Thanks in advance for your
> suggestions.
>
perl -e 'while (<>) { $seen{$1}++
if /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/; } print join("\n",sort keys %
seen) . "\n";' access_log
HTH
--
Joshua Colson
On May 18, Lance Murray said:
perl -i -p -e "s/oldhostname/newhostname/g" /etc/hosts
However, what is the syntax if I wanted to just process a text stream to
stdout?, e.g.:
cat /etc/hosts | perl "s/in_text/out_text/g"
Simple: use the -p and -e switches, but not the -i switch.
--
Jeff "japhy" Pin
On 5/18/05, Chris Devers <[EMAIL PROTECTED]> wrote:
> On Wed, 18 May 2005, Lance Murray wrote:
>
> > However, what is the syntax if I wanted to just process a text stream
> > to stdout?, e.g.:
> >
> > cat /etc/hosts | perl "s/in_text/out_text/g"
> >
> > I'm sure the answer is fairly simple. I'd j
Lance Murray wrote:
Hello:
Hello,
I've long used Perl's "in place edit" feature, and understand it and regex
fairly well, e.g.:
perl -i -p -e "s/oldhostname/newhostname/g" /etc/hosts
However, what is the syntax if I wanted to just process a text stream to
stdout?, e.g.:
cat /etc/hosts | perl "s/in_
On Wed, 18 May 2005, Lance Murray wrote:
> However, what is the syntax if I wanted to just process a text stream
> to stdout?, e.g.:
>
> cat /etc/hosts | perl "s/in_text/out_text/g"
>
> I'm sure the answer is fairly simple. I'd just like to use perl one
> liners in place of awk, cut, grep stateme
On 25-Apr-05, at 10:06 AM, Jay Savage wrote:
On 4/25/05, Kevin Horton <[EMAIL PROTECTED]> wrote:
I'm trying to write a perl one-liner that will edit an iCalendar
format file to remove To Do items. The file contains several
thousand lines, and I need to remove several multi-line blocks. The
blocks
On 25-Apr-05, at 10:06 AM, Jay Savage wrote:
On 4/25/05, Kevin Horton <[EMAIL PROTECTED]> wrote:
I'm trying to write a perl one-liner that will edit an iCalendar
format file to remove To Do items. The file contains several
thousand lines, and I need to remove several multi-line blocks. The
blocks
> I'm trying to write a perl one-liner that will edit an iCalendar
> format file to remove To Do items. The file contains several
> thousand lines, and I need to remove several multi-line blocks. The
> blocks to remove start with a line "BEGIN:VTODO" (without the quotes)
> and end with a line "EN
On 4/25/05, Kevin Horton <[EMAIL PROTECTED]> wrote:
> I'm trying to write a perl one-liner that will edit an iCalendar
> format file to remove To Do items. The file contains several
> thousand lines, and I need to remove several multi-line blocks. The
> blocks to remove start with a line "BEGIN:V
Hi Kevin
just hints, no solution :-)
Am Montag, 25. April 2005 12.59 schrieb Kevin Horton:
> I'm trying to write a perl one-liner that will edit an iCalendar
> format file to remove To Do items. The file contains several
> thousand lines, and I need to remove several multi-line blocks. The
> bl
Paul Kraus wrote:
> Now I wanted to replace any white space with a single space.
>
> I used this command
>
> perl -pi.bak -w -e "s/\s+/ /g" map.bat
>
> That worked correctly but it removed all of my new lines.
Because new lines are whitespace. Adding -l (ell) to the perl command is the
easiest
r [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 10, 2003 11:53 AM
> To: 'Paul Kraus'; Perl
> Subject: RE: one liner replace / with \
>
>
> Paul Kraus wrote:
> > I want to replace all forward slashes with back slashes is a file.
> > Using a one liner I tried
Paul Kraus wrote:
> I want to replace all forward slashes with back slashes is a file.
> Using a one liner I tried
>
> perl -I -i.bak -w -e 's!/!\\!g' map.bat
1) You don't need -I
2) You do need -p
3) You probably need to use double-quotes instead of single, due to Windows
shell brain damage.
PQ [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 02, 2003 1:29 PM
> To: Dan Muey; [EMAIL PROTECTED]
> Subject: RE: One liner If statements
>
> No specific reason why, was just exploring other ways to do the same thing. Messing
>around with the benchmark module and seeing whi
Jensen Kenneth B Sra Afpc/Dpdmpq wrote:
> Can else statements be added?
>
> print (hi), $somevar++ if( condition ) else print (bye);
good idea but it doens't work that way. try:
#!/usr/bin/perl -w
use strict;
my $var = 1;
$var ? ( print("hello world\n"),
$var++,
print("
", $somevar++ if condition;
is the same as
print ("hi", $somevar++) if condition;
which would print the unmodified value of $somevar. Something like:
hi5
:-)
Rob
> - Original Message -
> From: "Rob Dixon" <[EMAIL PROTECTED]>
> To: <[EMAIL P
cool , makes sense, just wondering
-Original Message-
From: Jensen Kenneth B SrA AFPC/DPDMPQ [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 1:29 PM
To: Dan Muey; [EMAIL PROTECTED]
Subject: RE: One liner If statements
No specific reason why, was just exploring other ways to
: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: RE: One liner If statements
Is there a specific reason you need to do it that way?
If you need to run a bunch of code why not use sub routines
if($hi eq $low) { &hi_is
print "hi";
$somevar++;
} else {
print "Joemama";
}
-Original Message-
From: Jensen Kenneth B SrA AFPC/DPDMPQ [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 1:17 PM
To: 'Tanton Gibbs'; [EMAIL PROTECTED]
Subj
On Thu, Jan 02, 2003 at 12:56:46PM -0600, Jensen Kenneth B SrA AFPC/DPDMPQ wrote:
> In reading messages on this list I've picked up some snippets like
>
> 'do some code here' if (condition);
>
> Can the same be done if you have an if statement like this
>
> If (condition){
> print "hi";
> $s
Can else statements be added?
print (hi), $somevar++ if( condition ) else print (bye);
-Original Message-
From: Tanton Gibbs [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 1:07 PM
To: [EMAIL PROTECTED]
Subject: Re: One liner If statements
also:
print (hi), $somevar++ if
also:
print (hi), $somevar++ if( condition );
- Original Message -
From: "Rob Dixon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 02, 2003 1:04 PM
Subject: Re: One liner If statements
> do {
> print "hi";
>
do {
print "hi";
$somevar++;
} if condition;
(You don't need to parenthesize the conditional expression in this format.)
HTH,
Rob
"Jensen Kenneth B Sra Afpc/Dpdmpq" <[EMAIL PROTECTED]> wrote in
message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> In reading messages on
Jerry Rocteur wrote:
>
> On Sunday, Dec 15, 2002, at 13:00 Europe/Brussels, John W. Krahn wrote:
> >> perl -e 'for (@ARGV) {rename $_,uc($_) unless -e "uc($_)"; } ' *
> >> What is wrong with it ???
> >
> > subs/functions don't interpolate in quoted strings.
> >
> > perl -e'-e uc||rename($_,uc)for@
On Sunday, Dec 15, 2002, at 13:00 Europe/Brussels, John W. Krahn wrote:
perl -e 'for (@ARGV) {rename $_,uc($_) unless -e "uc($_)"; } ' *
What is wrong with it ???
subs/functions don't interpolate in quoted strings.
perl -e'-e uc||rename($_,uc)for@ARGV' *
You're incredible John.. You must be
Jerry Rocteur wrote:
>
> Hi,
Hello,
> After you guys sent me all those wonderful links yesterday I've become
> a one liner freak ;-))
>
> This one is driving me crazy, no matter how I do the unless, it always
> ignores it and overwrites an existing file.
>
> I've been struggling with it for ho
>= Original Message From "Balint, Jess" <[EMAIL PROTECTED]> =
>Hello. What is wrong with this?
>
>perl -e 'for(1..300){sleep 1;print ".";}'
>
>It never prints anything.
>Thanks.
I wrote a script like this:
for (1..5) {
sleep 1;
print ".";
}
when i ran it, i timed it. it took
On Jul 23, Balint, Jess said:
>Is there a command line switch for that?
To automatically place a newline after every print(), use the -l switch.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan
STDOUT is line-buffered. either unbuffer it ($| = 1;) or use stderr
perl -e 'for(1..300){sleep 1;print STDERR ".";}'
On Tuesday, July 23, 2002, at 02:37 PM, Balint, Jess wrote:
> Hello. What is wrong with this?
>
> perl -e 'for(1..300){sleep 1;print ".";}'
>
> It never prints anything.
> Thank
Is there a command line switch for that?
-Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:50 PM
To: 'Balint, Jess'; '[EMAIL PROTECTED]'
Subject: RE: One Liner Problems
output is buffered.
try it like this
perl -e
output is buffered.
try it like this
perl -e 'for(1..300){sleep 1;print ".\n";}'
> -Original Message-
> From: Balint, Jess [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 2:37 PM
> To: '[EMAIL PROTECTED]'
> Subject: One Liner Problems
>
>
> Hello. What is wrong with this?
>
On Jul 23, Balint, Jess said:
>Hello. What is wrong with this?
>
>perl -e 'for(1..300){sleep 1;print ".";}'
>
>It never prints anything.
>Thanks.
Yes it does. It prints
".
"Tanton Gibbs" <[EMAIL PROTECTED]> wrote in message
019201c1c610$decae5e0$81486e0a@brooklyn">news:019201c1c610$decae5e0$81486e0a@brooklyn...
> I'm running perl on cygwin and trying to do the following one liner:
>
> perl -pi -e 'BEGIN{$pwd=`pwd`;} s/^HOME=.*/HOME=$pwd/;' makeinclude
>
> which wil
100 matches
Mail list logo