2010/6/26 Jenda Krynicky :
> From: mrwawa
>> That is correct. I decided to just write the output to a separate
>> file and then delete the original file. Thanks for all your help.
>>
>> Wade
>
> That's all you can do. If you just wanted to change a few characters
> you could open the file for re
On Tue, Jun 15, 2010 at 1:50 PM, mrwawa wrote:
> Is this possible, and if so how can I do it?
Can you give an example?
For example, using colons instead of tabs, if the input looks like this:
A:BC:D
then you want it to look like this:
A:B:C:D
Is that right?
Regards,
- Robert
--
To unsubsc
On Sun, Mar 14, 2010 at 4:43 PM, David Christensen
wrote:
> Parag Kalra wrote:
>>
>> So wanted to know if it is a possible to use any free opensource tool to
>> manage code (only locally) where actual and current code resides in
>> different local directory and I can checkout code locally in some
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
>>> easy way to do this. The length of the string and the numbe
On Sat, Nov 7, 2009 at 4:45 AM, Ramesh, Marimuthu wrote:
> I have some 3000 sgml files, where I need to change the tag case from
> upper case to lower case.
>
> Example: Change This is an image to id="IMG1">This is an image.
>
> Note that the tag name and the attribute name should only change and
I see. You want the output to look something like this:
$ perl -e 'for(my $total = 24.15; $total <3; $total *= 10) {
printf("Total:%10s\n", "\$" . sprintf("%.2f",$total)) ;} '
Total:$24.15
Total: $241.50
Total: $2415.00
Total: $24150.00
Not sure if there is a better way. My guess is
Is this what you are looking for:
$ perl -e '$total = 24.15 ; printf "Total: \$%.2f\n", $total; '
Regards,
- Robert
On Mon, Oct 26, 2009 at 11:57 AM, Bryan R Harris
wrote:
> Is there a good way to do printf's with currency symbols?
>
> I've tried this:
>
> printf "Total: \$%10.2f\n", $total;
>
On Mon, Oct 19, 2009 at 9:12 AM, Shawn H Corey wrote:
> Taylor, Andrew (ASPIRE) wrote:
>> Is there a 2GB filesize limit for perl? - we're running on verion 5.6.
>
> There is no file limit in Perl. There is no memory limit in Perl. Such
> limits are because of:
>
> * the hardware,
> * the OS,
> *
On Fri, Sep 25, 2009 at 5:46 AM, Shawn H Corey wrote:
> Robert Citek wrote:
>>
>> How does one transliterate in perl using a negated character class?
>
> echo "abcxyz" | perl -ple '$_ =~ tr/abz/N/c'
>
> See `perldoc perlop` and search for /tr\/SEARC
How does one transliterate in perl using a negated character class?
For example, I have a string abcxyz and I would like to turn it into
abNNNz. I've been able to do the following:
$ echo "abcxyz" | perl -plane '$_ =~ y/[abz]/N/ '
NNcxyN
so I figured negating would give me the negated set, but
Is there an easier way to swap two values in an array?
This works:
$ perl -le '@a=(1,2,3,4) ; ($a[0],$a[1])=($a[1],$a[0]) ; print
join("\t", @a) ; '
2 1 3 4
This doesn't:
$ perl -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print join("\t", @a) ; '
1 1 3 4
Regar
Nevermind, I knew I was overlooking something simple: use @ symbol.
$ perl -le '@a=(1,2,3,4) ; @a[0,1...@a[1,0] ; print join("\t", @a) ; '
2 1 3 4
Regards,
- Robert
On Fri, Jul 17, 2009 at 2:03 PM, Robert Citek wrote:
> Is there an easier way to swap
On Wed, Jul 8, 2009 at 6:57 PM, John Refior wrote:
> On Wed, Jul 8, 2009 at 7:34 AM, Anu P wrote:
>
>> I am trying to use the '-e' filetest operator and encountered some wired
>> behavior.
>> I have a tar.gz file which is around 2.6 G and this is the code...Tar.gz
>> file is in the same directory
The code you wrote should work as it worked for me when I tested it on
a 3 GB sized file:
$ ls -sh 3gb-file
3.0G 3gb-file
$ perl -le '$file="3gb-file" ;
unless (-e $file) { print ("nope") ; }
else { print ("yup") ; } '
yup
I tested it with files as large as 10 GB and it worked.
Could it be that
Hello all,
I am giving a presentation soon and will be talking a bit about perl.
I'd like to include an image about perl that describes it as the Swiss
army chainsaw. Ideally, I'd like to have a red chainsaw with the
white Swiss cross. Unfortunately, my Googling for images hasn't turn
anything u
On Wed, Apr 15, 2009 at 6:33 AM, John W. Krahn wrote:
> Robert Citek wrote:
>>
>> You probably want ($Lang == "fr")
>
> Probably not. You are using a numerical comparison on a string which will
> convert the string to a number so that is the same as saying: ($La
You probably want ($Lang == "fr")
Regards,
- Robert
On Wed, Apr 15, 2009 at 12:08 AM, Brian wrote:
> could someone please help me with this little problem?
> I am trying to include an if statement part way through printing.
> When the program reaches the line if ($Lang = fr ) { print "
> that
An alternate version:
my $value = ( $t1lsq{$interfaceName} >= 4) ? 4 : $t1lsq{$interfaceName};
and a test:
$ perl -le '
$t1lsq{$interfaceName}=2 ;
my $value = ( $t1lsq{$interfaceName} >= 4) ? 4 : $t1lsq{$interfaceName};
print $value
'
2
$ perl -le '
$t1lsq{$interfaceName}=5 ;
my $value = ( $t1l
-- Forwarded message --
From: Robert Citek <[EMAIL PROTECTED]>
Date: Jan 8, 2008 3:39 PM
Subject: Re: avoid using a temporary variable
To: "John W. Krahn" <[EMAIL PROTECTED]>
On Jan 8, 2008 3:09 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Joh
On Jan 8, 2008 2:33 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Robert Citek wrote:
> > $ ls | perl -e 'print "('\''" . join("'\'','\''", map { chomp; $_ }
> > (<>) ) . "'\'')
On Jan 8, 2008 11:14 AM, Tom Phoenix <[EMAIL PROTECTED]> wrote:
> On Jan 8, 2008 7:38 AM, Robert Citek <[EMAIL PROTECTED]> wrote:
> > What I really want to know is if there's a way to eliminate the
> > temporary variable.
>
> Are temporary variables quite
On Jan 8, 2008 9:40 AM, Robert Citek <[EMAIL PROTECTED]> wrote:
> On Jan 8, 2008 9:24 AM, Robert Citek <[EMAIL PROTECTED]> wrote:
> > What I really want to know is if there's a way to eliminate the
> > temporary variable. If not, that's fine. I was just w
On Jan 8, 2008 9:24 AM, Robert Citek <[EMAIL PROTECTED]> wrote:
> On Jan 8, 2008 8:59 AM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> > On Jan 7, 2008 6:59 PM, Robert Citek <[EMAIL PROTECTED]> wrote:
> > > How can I get rid of the @foo?
> > >
> &g
-- Forwarded message --
From: Robert Citek <[EMAIL PROTECTED]>
Date: Jan 8, 2008 9:24 AM
Subject: Re: avoid using a temporary variable
To: "Chas. Owens" <[EMAIL PROTECTED]>
On Jan 8, 2008 8:59 AM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> On Ja
How can I get rid of the @foo?
This does what I want, but uses the "temporary" variable @foo:
$ ls | perl -e '@foo=<>; chomp @foo ; print join(" ", @foo)'
This eliminates the temporary variable but doesn't work:
$ ls | perl -e 'print join(" ", chomp(<>))'
Thanks in advance.
Regards,
- Robert
On Aug 25, 2006, at 3:30 PM, John W. Krahn wrote:
This is a "feature" :-) This thread may help explain:
http://groups.google.com/group/perl.perl5.porters/browse_frm/thread/
2eca0c52a1b299c4/f655bddfdbf2d0d6?
lnk=st&q=&rnum=1&hl=en#f655bddfdbf2d0d6
One way to do what you want:
$ echo 'a:
On Aug 25, 2006, at 2:43 PM, Robert Citek wrote:
Why do these two commands not produce the same output?
$ perl -le 'print join("--", split(/: /, "a: b"))'
a--b
$ echo 'a: b' | perl -F'/: /' -lane 'print join("--", @F)'
Why do these two commands not produce the same output?
$ perl -le 'print join("--", split(/: /, "a: b"))'
a--b
$ echo 'a: b' | perl -F'/: /' -lane 'print join("--", @F)'
a: b
From reading 'perldoc perlrun' the -F option should behave just like
the pattern to split. What am I missing?
Rega
On Jul 26, 2006, at 2:59 PM, Steve Pittman wrote:
I am using activestate on a windows box ...the files I am parsing are
Unix files...I tried this so far...
open ( IN, "<$_[0]" )||die "Can't open DAT source file: $tempFile
$!\n";
while (){s/\r/\n/g;@lines = ;}#
close (IN);
On Aug 31, 2005, at 9:55 AM, Scott Taylor wrote:
[EMAIL PROTECTED] said:
Hi all. I am attempting to install DBD::Oracle from the perl CPAN
shell.
The installation script seems to assume that oracle is installed
locally. It asks me to set ORACLE_HOME to the path the oracle is
installed and
On Aug 13, 2005, at 8:22 AM, Offer Kaye wrote:
I have a text file with columns, where the columns may not be aligned,
and not all lines may have data in all columns:
header1 header2 header3header4
l1dat1l1dat2
On Jul 20, 2005, at 6:01 AM, Jeff 'japhy' Pinyan wrote:
Will need to digest the above a bit more.
For more, please read
perldoc perldata
to learn about slices, and
perldoc perlreftut
to be introduced to references. Further reading is:
perldoc perlref
perldoc perllol
perldoc pe
On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
Close. You want a hash slice.
@[EMAIL PROTECTED] = @vals;
A marvelously Perlish construct.
http://danconia.org
Swet! Thanks a bunch.
Do you have a good reference which explains this? I've looked in
both the Camel and Llama books
Is there an easier, more compact way to convert two arrays, on with
keys and the other with values, into a hash?
I have this sample code:
1 #!/usr/local/bin/perl -w
2
3 my $hash ;
4 my @keys =qw(col1 col2 col3);
5 @vals=qw(a b c);
6 for ($i=0; $i<=2 ; $i++)
On Jun 17, 2005, at 2:11 AM, Thomas Bätzler wrote:
Robert Citek <[EMAIL PROTECTED]>
Anyone have any ideas why code using Net::FTP on one machine
won't work on another?
However, the most common cause of problems with Net::FTP
is not a Perl but a networking problem - namely firewa
Anyone have any ideas why code using Net::FTP on one machine won't
work on another?
I have this piece of code that runs on a Red Hat 9 linux machine and
on one Mac OS/X 10.4.1. But this same code does not run on a second
OS/X 10.4.1 machine. By not run I mean it waits a long time on the
I found a variation of this in the Perl Nutshell book:
$ perl -le '
$foo="fee fie foe foo" ;
while ($foo =~ m/e/g ) {
push @bar, pos $foo ;
}
print join(":", @bar); '
2:3:7:11
Is there an equivalent way to do the same using map instead of an
explicit while loop? I'm guessing not, sinc
On Friday, Jan 28, 2005, at 11:52 US/Central, Richard Wood wrote:
How do I go about removing my email address from this
list?
If you send a blank message to e-mail [EMAIL PROTECTED], you'll
get a help file. Within that helpfile will be a line like so:
"To stop subscription for this address, mail
On Thursday, Nov 4, 2004, at 10:49 US/Central, Scott Pham wrote:
Why don't you just split the line and use the whitespace as separator?
$line =~ s/\s+/ /;
my
($record,$date,$cust,$temp1,$temp2,$temp3,$temp4,$temp5,$shipping,$paid
)
= split (/ /,$line);
As I was reminded the other day, split work
On Thursday, Nov 4, 2004, at 09:38 US/Central, Kevin Old wrote:
my $line = "31232000 07/28/04 DUC000 NET 60 DAYS RD64
UPSGNDSVR PREPAID";
What I'm looking for in lines like this are the customer number
(DUC000) and a "code" that starts with UPS, or if the code doesn't
start with U
On Sunday, Oct 31, 2004, at 21:11 US/Central, John W. Krahn wrote:
Robert Citek wrote:
On Saturday, Oct 30, 2004, at 20:52 US/Central, John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have to match patterns of the format
string1>string2
where the strings 1 & 2 can contain alphabets,numb
On Saturday, Oct 30, 2004, at 20:52 US/Central, John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have to match patterns of the format
string1>string2
where the strings 1 & 2 can contain alphabets,numbers and spaces. The
string are separated by '>' sign. I wrote the following code for this.
if(/([a-z
On Saturday, Oct 30, 2004, at 21:46 US/Central, [EMAIL PROTECTED] wrote:
My earlier post was not quite clear. I will explain my problem in
detail here.
I have a string whose length is say 5. I need to copy another string
into this string but from an offset of 10.
I tried using substr but this is a
On Wednesday, Sep 22, 2004, at 08:05 US/Central, Jenda Krynicky wrote:
Which means it's actually much easier than I had you believe:
$s = "sasas dfgfgh asasas asedsase";
while ($s =~ /(?=sas)/g) {
print "pos=",pos($s), " = '",substr($s,pos($s),3),"'\n";
}
Bas
On Tuesday, Sep 21, 2004, at 17:17 US/Central, Jenda Krynicky wrote:
How about this:
$s = "sasas dfgfgh asasas asedsase";
while ($s =~ /\G.*?(?=sas)./g) {
print "pos=",pos($s)-1, " = '",substr($s,pos($s)-1,3),"'\n";
}
Thanks. Seems to work, although I'm stil
Is there an equivalent for "index" that uses regular expressions
instead of exact string?
I've been looking at index, pos, m//, and the corresponding "$"
variables but nothing I've found so far does what I'm looking for.
Specifically, what I'm trying to do is find all the starting locations
o
On Saturday, May 29, 2004, at 11:04 US/Central, Roberto Etcheverry
wrote:
I tried at first with cpan and got the same result as you, don't know
why.
But if you go to CPAN search (seach.cpan.org) and look for
HTML::FormatText in 'modules' you can find it. Try
http://search.cpan.org/search?query=HT
On Saturday, May 29, 2004, at 09:03 US/Central, Roberto Etcheverry
wrote:
The usual way to install modules is to run 'cpan':
Here's a transcript of my cpan search:
# perl -MCPAN -e 'shell;'
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v1.7601)
Rea
On Friday, May 28, 2004, at 16:29 US/Central, Roberto Etcheverry wrote:
http://search.cpan.org/src/GAAS/HTML-Format-1.23/lib/HTML/FormatText.pm
Thanks. I looked for that tar file and couldn't find one. So, I used
a wget to download the module:
wget -m -nH -np
http://search.cpan.org/src/GAAS/
Hello all,
We are in the process of installing Request Tracker (
http://www.bestpractical.com/rt/ -- rt.3.0.11 ) on a Fedora box and are
running into an issue with installing the CPAN module HTML::FormatText.
RT requires it, yet CPAN no longer has it.
A google search find some in cache, but th
On Monday, April 19, 2004, at 01:40 PM, Robert Citek wrote:
I'm trying to compile the Digest::MD5 module. I tried to do it
directly via "perl -MCPAN -e 'install Digest::MD5' and got an error:
"Makefile:85: *** missing separator. Stop." So, I decided to do it
b
Hello all,
I'm trying to compile the Digest::MD5 module. I tried to do it
directly via "perl -MCPAN -e 'install Digest::MD5' and got an error:
"Makefile:85: *** missing separator. Stop." So, I decided to do it by
hand. Below is a transcript of what I tried. Has anyone else
experienced a s
On Thursday, January 8, 2004, at 08:22 AM, Daniel Staal wrote:
1. Upgrade to Panther. ;-) It includes Perl 5.8, and plenty more.
In the queue to do. Also, want to dual boot with Linux, but that's for
an other discussion forum. :)
2. Upgrade Perl following the directions at:
http://developer.ap
Hello all,
I have perl 5.6.0 on my Mac OS X. I'd like to install libnet.
However, when I try to use cpan, it wants to automagically upgrade my
perl to 5.8.2. All I really want is Net::FTP. What is my best course
of action:
- upgrade to perl 5.8.2 and then libnet-1.17
- upgrade to some othe
At 11:43 AM 10/29/2003 -0600, Andrew Gaffney wrote:
Rick Bragg wrote:
Hi,
I want to write a script that will test the contents of a file.
The file being tested will pass only if it contains nothing more than an
ip address on one line. Does anyone have a sample of a simple regex to
accomplish thi
At 04:56 PM 10/20/2003 -0500, Robert Citek wrote:
... How do I correct this? Should I just create the file (e.g using touch)?
Doing a touch seemed to work. Any caveates to doing this?
Regards,
- Robert
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
At 04:40 PM 10/20/2003 -0500, Robert Citek wrote:
... However, when I exited the CPAN shell, these two tests worked just fine:
# perl -MXML::Simple -e ';'
# perl -MXML::SAX -e ';'
I guess it worked afterall. Now on to testing real code.
I spoke too soon. I am trying the
At 01:12 PM 10/20/2003 -0700, LoneWolf wrote:
root>perl -MCPAN -e shell
when it comes up to the shell put this in:
o conf prerequisites_policy follow
At 01:45 PM 10/20/2003 -0600, Wiggins d Anconia wrote:
Are you getting an error from CPAN??
Eventually, yes but I guess the error messages did not ma
Hello all,
What is the easiest way to install a module from CPAN that has several
dependencies? Specifically, I want to install XML::Simple. However, that
module depends on a few other perl modules. For now, I'm downloading the
modules individually and installing them. But this seems to be
Hello Edward,
At 05:07 PM 9/5/2003 +0800, Edward Yang wrote:
>The problem is I do not get correct result from the following code:
>print ;
>or
>print ;
I don't use perl in Windows, but I can simulate a similar result on Linux
or Mac OS X:
mkdir "foo bar"
cd "foo bar"
touch a b c
cd ..
Hello all,
getppid returns the parent process ID given a processes ID. Is there a
corresponding function which returns a list of child processes IDs?
I could do an external system call to ps or pstree, but thought perhaps
something internal to perl might already exist. I've Googled, but haven'
At 04:18 PM 8/18/2003 -0700, John W. Krahn wrote:
> ... it looks like you want a closure instead.
>
>{ # limit scope of $bar
>my $bar = 100;
>sub foo { ++$bar }
>}
Thanks for the example. I quess I do want closure. I'm not clear on how
closure differs from memoizing. Regardless, this worked e
Hello all,
I want a variable to be memoized, that is, keep the variable available only
to the function and the value remembered across invocations. So far, I
have created two versions listed below, both of which "work." The first
version prints a warning message 'Variable "$bar" will not stay s
Hello all,
I want to format a number so that it has commas as a separator. Here's the
code I came up with:
my $num=12345678;
print scalar reverse( join(",", grep( /./ ,split
(/(...)/,reverse($num), "\n";
This works but was wondering if anyone might suggest a better method.
Regards,
- Robe
Hello all,
What would I need in order to write a perl script to query an Oracle database?
I have written perl scripts to connect to MySQL and PostgreSQL databases.
In those cases, both the databases and the scripts were run on Red Hat
Linux v7.1/2. This time, I am trying to write a perl script
Hello all,
How can I find out information about a system in a system-independent manner?
I wrote a perl script that nicely displays information about a Linux
system: # of cpus, cpu speed, size of RAM, # of disks, size of disks, IP
address. The code uses the system() command and relies on the /p
At 06:53 AM 2/20/2003 -0800, Paul wrote:
>the range op is short-circuiting on the negative.
>try
>
> @f[1..$#f-1]
Worked like a charm. Thaks, Paul. - Robert
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Is there a short-cut way in perl to slice an array with the range (..)
operator?
I am trying to get a slice of an array from the second element to the
second to last element. This would be equivalent to a shift and a pop,
except that I do not want to modify the array itself. This is the closest
Hello Zeus,
At 11:55 AM 1/29/2003 -0500, Zeus Odin wrote:
>An even shorter version of yours is:
>-
>my @a;
>while(){
> next unless /=/ && chomp;
> push @a, split /=/, $_, 2;
>}
>print "$_\n" for @a;
>-
This is even shorter, eliminates all uses
Hello Zeus,
At 09:49 AM 1/29/2003 -0500, Zeus Odin wrote:
>I have spent a very LONG time trying to determine why this script is not
>splitting properly only on lines that have equals marks and only on the
>first equals.
I'm not quite sure what you are trying to do. So below is a modified
versio
At 01:43 PM 11/6/2002 -0500, Charlotte Oliver wrote:
>You could also try "locate perl" or "whereis perl" on the command line.
>Usually it's someplace like \usr\bin\perl, though.
>
>I don't run Redhat though, so your mileage may vary.
'locate' and 'whereis' work only if perl is already installed.
Hello Stacy,
At 07:56 PM 11/5/2002 -0800, stacy wilmshurst wrote:
>hey can someone give me a tip to where i can find the pearl
>packages on redhat8?
>i'm getting real confused trying to set them up
>but i know they're there...
>
>help please
Since this is a perl list, I am assuming you meant "pe
y to your needs.
Regards,
- Robert
-
#!/usr/bin/perl -w
# (c) 2002 - Robert Citek
# released under the GPL (http://www.gnu.org/licenses/gpl.txt)
use strict;
use English; # I prefer $NR over $.
my $num=4;
my @fh;
# create an array of filehandles
for (my $i=0; $i<$num ; $i++) {
Hello LRMK,
At 11:51 PM 11/5/2002 +0600, LRMK wrote:
>#!/usr/bin/perl -w
>my $a;
>if ($a eq 'fff'){
>}
>above line gives the error Use of uninitialized value in string eq
>at t.pl line 6.
>
>but when -w not used in top line it works perfect
>what the -w really does
You've created $a but not se
Hello Gajo,
A different approach to your problem is to use a data structure, e.g. an
array or hash. Your script rewritten using an array,
#!/usr/bin/perl -w
my @option = ("one","two","three","four","five","six","maybe seven?");
print "Type in a number 1-", $#option+1, ": ";
$s = ;
chomp $s ;
i
Hello Charles,
At 12:22 PM 10/31/2002 -0500, [EMAIL PROTECTED] wrote:
>
>I have a file that looks like
>0
>232,32387,2323
>
>I am only interested in the last set of digits on the second line. My plan
>was to split on coma and take the 3 element of the array. I am having
>problems skipping the fi
At 12:04 AM 10/26/2002 +0200, Jenda Krynicky wrote:
>From: Robert Citek <[EMAIL PROTECTED]>
>> This sounds like something that perl should be able to handle by
>> changing the locale so that you do not have to alter the source file.
>
>I hope NOT! This would break tons
At 10:47 PM 10/30/2002 +0100, Jenda Krynicky wrote:
>From: "Jerry Preston" <[EMAIL PROTECTED]>
>> Is it possible to access MS access from Perl? If so, how?
>
>Sure. Use DBI and DBD::ODBC or Win32::ODBC or Win32::ADO or DBI with
>DBD::ADO :-)
Extending the question a bit, can I access an MS Acce
Hello Cleiton,
At 02:36 PM 10/25/2002 -0700, Cleiton L. Siqueira wrote:
>Thanks for your help!!!
No problem.
>I was making a mistake with my source file. My file has numbers like
>this 2,25. Perl uses "." and not "," to decimal numbers.
>I changed the "." to "," in the file and now it's workin
Hello Scot,
At 07:44 PM 10/25/2002 -0700, Scot wrote:
> Anybody figured out a good regular expression to match all
>2am crons ? match 0,10,20,30,40,50 2 * * * and 0 2 * * *
You can use automatic splitting:
echo '0,10,20,30,40,50 2 * * *' |
perl -wane 'print if $F[1] == 2 ;'
or use awk:
Hello Cleiton,
At 01:32 PM 10/25/2002 -0700, Cleiton L. Siqueira wrote:
>I've tried to add two variables, but the result isn't right.
>Because when Perl add the both it removes the decimal numbers from the
each variable.
>How can I add these variables in perl?
Does this one-liner work on your sy
Hello Kristi,
At 10:22 AM 10/24/2002 -0500, Goodman Kristi - kgoodm wrote:
>Does anyone know why Perl has a hard time with large numbers and sometimes
>turns them into negative numbers? Sorry if I am not being specific enough,
>but really all I am doing is calculating the number of records in a
Can someone show me an example of how I can mix long and short options with
Getopt?
I would like to pass options to a perl script that can take both short and
long options. For example, all of these commands work (this is GNU tar):
# tar -tzvf foo.tar.gz
# tar --list zvf foo.tar.gz
# tar
Hello all,
Questions:
How can I tell if a file is compressed (gzip or compress)?
Can I use seek/tell on a pipe or fifo?
If not, are there work-arounds?
Background:
I currently have a script that opens a file, seeks to a position, reads
some data, and quits. I would like to expand the functiona
Hello Daryl,
At 09:05 AM 8/20/2002 -0500, Daryl J. Hoyt wrote:
> I am looking for a way to run something like a cron job on windows. I
>would like to check every 10 minutes to see if an application is running.
>If it is not running, I would then like to launch it. Is there a way to do
>t
Hello Chris,
At 10:23 PM 4/20/2002 +0100, Chris Ball wrote:
>>>>>> "Robert" == Robert Citek <[EMAIL PROTECTED]> writes:
>
>Robert> Some CPAN modules/tarfiles have filenames that have two
>Robert> colons in them, e.g. foo::bar. Wh
Some CPAN modules/tarfiles have filenames that have two colons in them,
e.g. foo::bar. While this works fine under Unix/Linux, Windows complains.
I believe MacOS 9 would balk about this, too. Not sure about darwin/MacOS X.
Regards,
- Robert
At 01:43 PM 4/15/2002 -0700, A. Rivera wrote:
>Fork
Hello James,
Here's a perl way that seems to work:
perl -ne 's#\012#\015\012#g; print' filename
Regards,
- Robert
--
At 03:02 PM 9/26/2001 -0500, Gibbs Tanton - tgibbs wrote:
>Many unix systems have both a dos2unix and unix2dos command...you might try
>that.
>
>-Original Message---
Hello Ricardo,
At 12:57 PM 9/19/2001 -0300, Ricardo Derbes wrote:
>I dont think it can be opened,
Not quite correct. Let's say the file is called cpan.iso. Here's how you
can print the first "word characters" within the first 33000 bytes of the
file:
#!/usr/bin/perl -w
use strict;
my ($stri
Hello Michael,
I tried to duplicate your error, but was unable to. This is my test script
which is modelled on your origninal script:
#!/usr/bin/perl -w
use strict;
foreach my $foo qw(a b) {
print "$foo\n";
system ("echo hi $foo");
print "hello $foo\n";
print "\n";
}
Regardless of
Hello Curtis,
At 09:12 AM 9/13/2001 -0700, Curtis Poe wrote:
>I would try to avoid using DATA as the filehandle as this
>may cause confusion with the __DATA__ token.
Excellent stylistic point.
>Also, if you're going to read the entire file into an array, this
>is faster and (IMHO) easier t
At 05:27 PM 9/13/2001 +0200, Jorge Goncalvez wrote:
>Hi, How in Perl you can store each line of a file in an array?
>From section 4.1 in the Perl Cookbook
(http://www.oreilly.com/catalog/cookbook/):
@bigarray = ();
open(DATA, "< mydatafile") or die "Couldn't read from datafile: $!\n";
whil
Hello Sofia,
What is happening is that only STDOUT is being saved in the @output array.
STDERR is still going to the console (your screen). If on a UNIX/Linux
system, try adding "2>&1" in front of your command like this:
@output = `2>&1 infoerr_parse.pl`;
The "2>&1" redirects any output to f
Hello Tyler,
A return value of 0 from a system call means that it ran successfully. Any
other value means something went wrong. For example, this script:
#!/usr/bin/perl -w
use strict;
my $system;
$system = system("echo Hello, World");
print $system . "\n";
$system = system("grok
Hello Richard,
At 09:14 AM 9/11/2001 -0400, Richard Brust wrote:
>I am trying to print lines from an HTML page that have a certain
>date(today). The following works:
>
>lynx -dump http://www.tbri.com/News/pgPubCal.asp | grep "Sep 11"
This did not work for me. Changing "Sep 11" to "Sep" worked
Hello Alla,
At 10:42 AM 9/11/2001 -0700, [EMAIL PROTECTED] wrote:
>Hi,
>Is perl has limitation of dealing with files bigger then 2 GBytes?
Yes and no. For my boxes running RedHat linux 7.1, I rebuilt the RPM from
the src.rpm file. Specifically, I changed one of the options in the
perl.spec fi
Hello Ryan,
Replace this line:
$body=~[what goes here?]
with this:
$body=~ s/\n/\n/g;
or this:
$body=~ s/\n//g;
Do either of these do what you intend?
Regards,
- Robert
-
At 04:44 PM 9/7/2001 -0700, Ryan Kane wrote:
[...]
>from the script:
>--
>#!/usr/lo
97 matches
Mail list logo