Re: while<> was Re: avoid backticking if at all possible - Re: perl awk question

2002-05-21 Thread drieux
On Tuesday, May 21, 2002, at 04:24 , Peter Scott wrote: [..] > This is somewhat religious, of course, and the rest of software development is not a matter of studying the medieval heresy trials and resolving which side of satan your current project is on > and I'm not invalidating your appr

Re: avoid backticking if at all possible - Re: perl awk question

2002-05-21 Thread drieux
On Tuesday, May 21, 2002, at 06:16 , Tor Hildrum wrote: > You can use the $ARGV[X] values directly like above, or you can put them > in > variables. I guess that's what drieux did. Everything passed from the > command line are put into to the @ARGV array. > So, when I write > % ./argv.pl 2 3 ba

Re: avoid backticking if at all possible - Re: perl awk question

2002-05-21 Thread Todd Wade,,,Room 108
Drieux wrote: > foreach my $file (@ARGV) { # for everything we see on the command line > # let us assume it is a file for simplicity > if ( -f $file ) { > open(FH, "$file"); # normally we want to die > print $_ while(); # silly but a one liner > # could have been while() { print $_ ;} > # but tha

Re: avoid backticking if at all possible - Re: perl awk question

2002-05-21 Thread Tor Hildrum
> From: "Taylor Lewick" <[EMAIL PROTECTED]> > Date: Tue, 21 May 2002 08:00:45 -0500 > To: <[EMAIL PROTECTED]> > Subject: avoid backticking if at all possible - Re: perl awk question > > Thanks drieux, I looked over the code you posted, most of it makes

avoid backticking if at all possible - Re: perl awk question

2002-05-21 Thread Taylor Lewick
Thanks drieux, I looked over the code you posted, most of it makes sense, but am still a little confused over a couple of things, Why are you setting $infile and $outfile to ARGV values? I thought those were being past from the command line, but in this instance, I know what files I want to acc

while<> was Re: avoid backticking if at all possible - Re: perl awk question

2002-05-20 Thread drieux
On Monday, May 20, 2002, at 10:43 , Peter Scott wrote: [..] > At 10:25 PM 5/20/02 -0700, drieux wrote: [..] >>> print while <>; >> >> I thought that was a synonym for STDIN? > > Only in certain cases. It iterates over @ARGV; it's special. Look under > "I/O Operators" in perlop. "Well

Re: avoid backticking if at all possible - Re: perl awk question

2002-05-20 Thread Peter Scott
At 10:25 PM 5/20/02 -0700, drieux wrote: >On Monday, May 20, 2002, at 05:48 , Peter Scott wrote: >>At 02:52 PM 5/20/02 -0700, drieux wrote: >[..] >>> open(FH, "$file"); # normally we want to die >>> print $_ while(); # silly but a one liner >[..] >>I missed the e

Re: avoid backticking if at all possible - Re: perl awk question

2002-05-20 Thread drieux
On Monday, May 20, 2002, at 05:48 , Peter Scott wrote: > At 02:52 PM 5/20/02 -0700, drieux wrote: [..] >> open(FH, "$file"); # normally we want to die >> print $_ while(); # silly but a one liner >> [..] > I missed the earlier articles in the thread so may be off

Re: avoid backticking if at all possible - Re: perl awk question

2002-05-20 Thread Peter Scott
At 02:52 PM 5/20/02 -0700, drieux wrote: >What may help the process here is to think 'cat' but in 'perl' > > #!/usr/bin/perl -w > use strict; > > foreach my $file (@ARGV) { # for everything we see on the command > line >

avoid backticking if at all possible - Re: perl awk question

2002-05-20 Thread drieux
On Monday, May 20, 2002, at 12:40 , Taylor Lewick wrote: Taylor, as your code indicates you are still thinking in classical shell terms of 'well fork a bunch of sub children and let the kernel resolve the stdin to stdout connections.' which is where most of us start - nothing wrong with it.

Re: perl awk question

2002-05-20 Thread John W. Krahn
Taylor Lewick wrote: > > Hi, > I have the following one liner which works great in a shell script. > I have a comma delimited text file with the same number of rows. > I want to add the date in -MM-DD format to every line... > > I was doing this.. > cat $file | awk '{print $0 "," "'$fdate'"}

Re: perl awk question

2002-05-20 Thread drieux
On Monday, May 20, 2002, at 01:07 , Ovid wrote: >> I want to add the date in -MM-DD format to every line... >> >> I was doing this.. >> cat $file | awk '{print $0 "," "'$fdate'"}' >>$new_file >> >> Works great [..] too many letters to type [..] > If you're trying to do this in a one-liner

Re: perl awk question

2002-05-20 Thread Ovid
--- Taylor Lewick <[EMAIL PROTECTED]> wrote: > Hi, I have the following one liner which works great in a shell script. I have a >comma > delimited text file with the same number of rows. > I want to add the date in -MM-DD format to every line... > > I was doing this.. > cat $file | awk

perl awk question

2002-05-20 Thread Taylor Lewick
Hi, I have the following one liner which works great in a shell script. I have a comma delimited text file with the same number of rows. I want to add the date in -MM-DD format to every line... I was doing this.. cat $file | awk '{print $0 "," "'$fdate'"}' >>$new_file Works great Unfo