<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: awk vs. perl ... print $1? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848876#M99650</link>
    <description>here it is.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.perl.com/doc/manual/html/x2p/a2p.html" target="_blank"&gt;http://www.perl.com/doc/manual/html/x2p/a2p.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I used it to convert over 100 awk scripts and ran into only but a handfull errors. which needed only a little editing.</description>
    <pubDate>Mon, 23 Jun 2003 22:56:22 GMT</pubDate>
    <dc:creator>Donny Jekels</dc:creator>
    <dc:date>2003-06-23T22:56:22Z</dc:date>
    <item>
      <title>awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848871#M99645</link>
      <description>Hi, perl gurus.&lt;BR /&gt;&lt;BR /&gt;If someone could point me to the best/shortest way to convert a simple awk script to perl, I will relegate awk to the mental dustbin of seldom-used commands.&lt;BR /&gt;&lt;BR /&gt;$awk -F: '{ print $1 }' /etc/passwd&lt;BR /&gt;&lt;BR /&gt;a2p returns something absolutely ghastly for this one-liner.  Is there a way, oh perl gurus, to repeat the elegance of the above awk solution in perl?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 23 Jun 2003 21:36:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848871#M99645</guid>
      <dc:creator>A. Daniel King_1</dc:creator>
      <dc:date>2003-06-23T21:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848872#M99646</link>
      <description>Hmmnnn...this may help a bit:&lt;BR /&gt;&lt;BR /&gt;# Sort /etc/passwd by user name.&lt;BR /&gt;&lt;BR /&gt;$sort = Sort::Records-&amp;gt;&lt;BR /&gt;    new([width =&amp;gt; 10,&lt;BR /&gt;         split =&amp;gt; [':', 0]]);&lt;BR /&gt;@pw = $sort-&amp;gt;sort(`cat /etc/passwd`);&lt;BR /&gt;&lt;BR /&gt;# Sort /etc/passwd by user ID.&lt;BR /&gt;&lt;BR /&gt;$sort = Sort::Records-&amp;gt;&lt;BR /&gt;    new([type  =&amp;gt; 'int',&lt;BR /&gt;         split =&amp;gt; [':', 2]]);&lt;BR /&gt;@pw = $sort-&amp;gt;sort(`cat /etc/passwd`);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Mon, 23 Jun 2003 22:07:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848872#M99646</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2003-06-23T22:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848873#M99647</link>
      <description>well belive it or not your perl distribution should have come with awk2perl, and a sed2perl convertor.&lt;BR /&gt;&lt;BR /&gt;do a find for these scripts.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die</description>
      <pubDate>Mon, 23 Jun 2003 22:49:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848873#M99647</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-06-23T22:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848874#M99648</link>
      <description>I'm not a perl guru, but ...&lt;BR /&gt;I want to play too! ;-)&lt;BR /&gt;&lt;BR /&gt;perl -anF: -e 'print @F[0],"\n"' /etc/passwd&lt;BR /&gt;&lt;BR /&gt;Of course, I would probably really use&lt;BR /&gt;&lt;BR /&gt;cut -d: -f1 /etc/passwd&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Jun 2003 22:52:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848874#M99648</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2003-06-23T22:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848875#M99649</link>
      <description># perl -aF: -nle'print $F[0]' /etc/passwd&lt;BR /&gt;&lt;BR /&gt;is exactly the same as one-liner&lt;BR /&gt;&lt;BR /&gt;-a autosplit to @F&lt;BR /&gt;-F: split on : instead of whitespace&lt;BR /&gt;-n don't print for every line&lt;BR /&gt;-l print newlines after every print (not for printf's)&lt;BR /&gt;-e use perl expression&lt;BR /&gt;&lt;BR /&gt;$F[0] is the first field, perls lists/arrays are indexed starting from 0&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Mon, 23 Jun 2003 22:54:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848875#M99649</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-06-23T22:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848876#M99650</link>
      <description>here it is.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.perl.com/doc/manual/html/x2p/a2p.html" target="_blank"&gt;http://www.perl.com/doc/manual/html/x2p/a2p.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I used it to convert over 100 awk scripts and ran into only but a handfull errors. which needed only a little editing.</description>
      <pubDate>Mon, 23 Jun 2003 22:56:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848876#M99650</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-06-23T22:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848877#M99651</link>
      <description>and here is the link to sed to perl.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.ictp.trieste.it/texi/perl/perl_72.html" target="_blank"&gt;http://www.ictp.trieste.it/texi/perl/perl_72.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hey sorry for the earlier post. about awk2perl and sed2perl.&lt;BR /&gt;&lt;BR /&gt;its a2p and s2p, which are free translators and free to download.&lt;BR /&gt;&lt;BR /&gt;good luck with your translation expidition.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;Donny</description>
      <pubDate>Mon, 23 Jun 2003 23:00:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848877#M99651</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-06-23T23:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848878#M99652</link>
      <description>Donny, why do you litter this thread with exactly what he does *NOT* want. Read the original question again please.&lt;BR /&gt;&lt;BR /&gt;Mike, are you using perl6? Though @F[0] is valid use in perl5, it is an array slice of only one element, it's use in your context is highly obfuscating.&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Tue, 24 Jun 2003 06:55:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848878#M99652</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-06-24T06:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848879#M99653</link>
      <description>Thanks, everyone for your posts.&lt;BR /&gt;&lt;BR /&gt;Once again, Procura, you have come through.&lt;BR /&gt;&lt;BR /&gt;I'm not certain I would have caught the obfuscation with @F[0]!</description>
      <pubDate>Tue, 24 Jun 2003 13:03:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848879#M99653</guid>
      <dc:creator>A. Daniel King_1</dc:creator>
      <dc:date>2003-06-24T13:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848880#M99654</link>
      <description>an AWK fyi here.&lt;BR /&gt;you forgot the //.  &lt;BR /&gt;awk -F: '// {print $1 }' /etc/passwd&lt;BR /&gt;&lt;BR /&gt;and what about cut?&lt;BR /&gt;cat /etc/passwd | cut -d: -f1&lt;BR /&gt;&lt;BR /&gt;steve</description>
      <pubDate>Wed, 25 Jun 2003 11:09:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848880#M99654</guid>
      <dc:creator>Steve Post</dc:creator>
      <dc:date>2003-06-25T11:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848881#M99655</link>
      <description>Steve,&lt;BR /&gt;&lt;BR /&gt;Could you clarify the meaning of the //?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 14 Jul 2003 15:54:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848881#M99655</guid>
      <dc:creator>A. Daniel King_1</dc:creator>
      <dc:date>2003-07-14T15:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848882#M99656</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;perl -aF: -nel 'print $F[0]'/etc/passwd&lt;BR /&gt;Should work.&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Mon, 14 Jul 2003 19:09:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848882#M99656</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-07-14T19:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848883#M99657</link>
      <description>I thought this message had already run its course.  Sorry.  About that. &lt;BR /&gt;&lt;BR /&gt;On the "//"   in the Awk command.  &lt;BR /&gt;The // means "for every line."  &lt;BR /&gt;&lt;BR /&gt;You didn't have // in your awk script.  I don't know what it was doing.  &lt;BR /&gt;&lt;BR /&gt;Normally I use awk this way.&lt;BR /&gt;&lt;BR /&gt;cat file | awk  '&lt;CRITERIA to="" select="" line=""&gt; { action to do}'&lt;BR /&gt;&lt;BR /&gt;You gave awk an action to do, but did not select any lines?  &lt;BR /&gt;&lt;BR /&gt;other selections.&lt;BR /&gt;if field 2 is not billy, print the line.&lt;BR /&gt;  awk '$2 !~ /billy/ { print $0 }'&lt;BR /&gt;&lt;BR /&gt;if the line begins with hoohay, print field 3.&lt;BR /&gt;  awk '/^hoohay/ { print $3 }'&lt;BR /&gt;&lt;BR /&gt;print something at the start and end.&lt;BR /&gt;  awk  'BEGIN {  print "this is the start.\n" }&lt;BR /&gt;   //  { printf("here is a line %s\n",$0) }&lt;BR /&gt;       END { print "this is the end." }'&lt;BR /&gt;&lt;BR /&gt;steve.&lt;BR /&gt;&lt;/CRITERIA&gt;</description>
      <pubDate>Thu, 17 Jul 2003 13:25:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848883#M99657</guid>
      <dc:creator>Steve Post</dc:creator>
      <dc:date>2003-07-17T13:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848884#M99658</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;// is implied so...&lt;BR /&gt;awk '{print $1}' file&lt;BR /&gt;is the same as&lt;BR /&gt;awk '//{print $1}'&lt;BR /&gt;&lt;BR /&gt;I never use // &amp;amp; my awk works fine!!!!&lt;BR /&gt;&lt;BR /&gt;Tim&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2003 13:34:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848884#M99658</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2003-07-17T13:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848885#M99659</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;// is implied so...&lt;BR /&gt;awk '{print $1}' file&lt;BR /&gt;is the same as&lt;BR /&gt;awk '//{print $1}' file&lt;BR /&gt;&lt;BR /&gt;I never use // &amp;amp; my awk works fine!!!!&lt;BR /&gt;&lt;BR /&gt;Tim&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2003 13:34:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848885#M99659</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2003-07-17T13:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848886#M99660</link>
      <description>ok Tim.  I bet you're right.  But I'm not the author.  I can't see what version of awk he's using.  &lt;BR /&gt;Maybe // does not have to be there.  &lt;BR /&gt;I just put it in out of habit.  In any case, you see it means "grab all lines."&lt;BR /&gt;steve&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2003 13:40:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848886#M99660</guid>
      <dc:creator>Steve Post</dc:creator>
      <dc:date>2003-07-17T13:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848887#M99661</link>
      <description>Old postings I know but...&lt;BR /&gt;Try this! Much more readable.&lt;BR /&gt;&lt;BR /&gt;cat /etc/passwd | perl -anF: -e 'print $F[0],"\n"' -&lt;BR /&gt;&lt;BR /&gt;Substitute the 0 for whichever column you want.&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Mar 2006 07:33:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848887#M99661</guid>
      <dc:creator>Brian Burroughs</dc:creator>
      <dc:date>2006-03-29T07:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848888#M99662</link>
      <description>Ugh.  Actually, that is basically what procura and Mike's posts said.&lt;BR /&gt;&lt;BR /&gt;During one of the forum upgrades however, all ['s got translated into their html [ values, and ]'s into ].</description>
      <pubDate>Sat, 01 Apr 2006 17:33:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848888#M99662</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2006-04-01T17:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848889#M99663</link>
      <description>LOL&lt;BR /&gt;&lt;BR /&gt;Here's me thinking I was being clever.</description>
      <pubDate>Mon, 03 Apr 2006 01:25:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848889#M99663</guid>
      <dc:creator>Brian Burroughs</dc:creator>
      <dc:date>2006-04-03T01:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: awk vs. perl ... print $1?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848890#M99664</link>
      <description>Not quite as elegant, but probably more extensible.  Thanks, all.</description>
      <pubDate>Mon, 22 May 2006 13:09:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-vs-perl-print-1/m-p/4848890#M99664</guid>
      <dc:creator>A. Daniel King_1</dc:creator>
      <dc:date>2006-05-22T13:09:56Z</dc:date>
    </item>
  </channel>
</rss>

