On Wed, 2004-08-11 at 16:08, [EMAIL PROTECTED] wrote:
You can do it in awk and translet it to perl with a2p
> All,
>
> wasn't sure if this was received b/c I got a reurne to sender error.
>
>
> How can I print certain fields delimited by ' '?
> In awk I would write awk '{print $1, $6}' filenam
<[EMAIL PROTECTED]> asked:
> How can I print certain fields delimited by ' '?
> In awk I would write awk '{print $1, $6}' filename
In Perl, that would be
perl -lane 'print "$F[0] $F[1] $F[5]"' filename
See the perlrun manpage about all of the command line
switches. Here I use
-e - run P
[EMAIL PROTECTED] wrote:
All,
Hello,
wasn't sure if this was received b/c I got a reurne to sender error.
How can I print certain fields delimited by ' '?
In awk I would write awk '{print $1, $6}' filename
The Perl equivalent of that is:
perl -lane 'print "@F[0,5]"'
Here is an out file that I wan
; <[EMAIL PROTECTED]>
08/13/2004 08:51 AM
To: Perl Beginners <[EMAIL PROTECTED]>
cc:
Subject:Re: awk like question
[EMAIL PROTECTED] wrote:
> All,
Hello,
> wasn't sure if this was received b/c I got a reurne to sender error.
>
gt; local $, = "\t";
> print FOO +(split)[0,1,5], $/;
> #print +(split)[0,1,5], $/;
>
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
> 614-566-4145
>
> "John W. Krahn" <[EM
On Aug 13, Errin Larsen said:
>um, can anyone explain the 'print' function below to me?
>
>specifically ... this:
>
> 'print "@F[0,5]"'
perldoc perlrun
The @F array is created when the -a commandline switch is used in
conjunction with -n or -p. Read 'perlrun' to find out more.
--
Jeff "jap
t +(split)[0,1,5], $/;
> >
> > Derek B. Smith
> > OhioHealth IT
> > UNIX / TSM / EDM Teams
> > 614-566-4145
> >
> > "John W. Krahn" <[EMAIL PROTECTED]>
> > 08/13/2004 08:51 AM
> >
> > To: Perl Beginners <[EM
t; > ## look for 9840S and ebexpire
> > > > ## declare OFS = tab
> > > > ## tell split to split on IRS 0,1&5. very similar to awk
> > > > print $
> > > >
> > > > if (($
xpire
> > > ## declare OFS = tab
> > > ## tell split to split on IRS 0,1&5. very similar to awk
> > > print $
> > >
> > > if (($_ =~ /9840S/) && ($_ =~ /ebexpire, ebexpire/ )) {
> > >
t; > while () {
> > > >
> > > > ## look for 9840S and ebexpire
> > > > ## declare OFS = tab
> > > > ## tell split to split on IRS 0,1&5. very similar to awk
> > > > print $
> >
Errin Larsen wrote:
> ok. I'm not getting my question across clearly. Let me try again.
>
> I have a collection of data in a text file. Here is an example:
>
> ## foobar.txt ##
> one two three
> A B C
> yes nomaybe
>
> In a script (not on the command line) I want to be able to
11 matches
Mail list logo