Comment from: Justin Davis [Visitor]
**---
Justin DavisI love perl but I still love awk. For simple tasks awk is easier to use. Like your second example:

ls -l | awk '{ print $1, $3, $4 }'

Awk is worth knowing as well. My advice is don't dismiss awk like others dismiss perl.
09/29/11 @ 14:24
Comment from: Robin Smidsrød [Member] Email
Thanks for the feedback!

I agree that each tool has its strengths, and I think awk and perl are useful for a lot of things. I'm guessing awk probably has a smaller memory footprint as well.

But I must admit that this use of awk as shown above is probably the only one I use on a regular basis. Perl, as the swiss army chainsaw it is, I use for most other text parsing/processing I need.
09/30/11 @ 14:45
Comment from: JRFerguson [Visitor]
*****
JRFergusonUsing:

ls -l | perl -lane 'print @F[0,2..3]

...should probably include some inter-field delimiter on output, e.g. :

ls -l | perl -lane 'print join q( ), @F[0,2..3]
10/03/11 @ 16:08
Comment from: Robin Smidsrød [Member] Email

perldoc perlvar shows that $LIST_SEPARATOR ($") is used to separate values in an array variable inside double-quoted strings. It's default value is a single space. This means you can use this construct to ensure you get a space:


ls -l | perl -lane 'print "@F[0,2..3]"'
10/03/11 @ 19:10
Comment from: lou fridkis [Visitor]
****-
lou fridkismy favorite:

ls -l | perl -lane '$sum+=$F[4];print "sum=$sum" if(eof)'

# print the total storage of the directory
10/11/11 @ 23:09
Comment from: andrez [Visitor] Email
*****
andrezit is excelent!i still love awk
as i compare perl lane can beat both "sed and awk" by the way can i know if you dont mind
how to translate this awk to perl one liner# iam newbe on perl#:

#!/bin/sh
for i in `cat $TMP/out#$d#$$ |awk '{print $4}' `
do
myloc=`grep $SITEX $TMPLOC/SITE_LOC | awk -F "|" '{print $2}' | sort -u `
cat filena#e#txt | grep $i | awk -v B=$myloc ' {printf#"%-8s %-20s %-25s %-10s %s %s %-30s\n",$1,$2,$3,$4,$5,$6,""B""#}' >> outfile.txt
done
hope you can help me
Kind Regards
Andrez
07/04/12 @ 11:17
Comment from: Craig [Visitor]
***--
CraigWhy not just use: "cut -f1 -d' '"?
07/06/12 @ 04:47
Comment from: Craig [Visitor]
CraigPerl isn't a replacement for AWK, as I've heard all too often. The real value of AWK is that it acts as a filter by default. If you don't know much AWK and you do know Perl, it's fine to use what you know. But it's wrong to say Perl can replace the simplicity of AWK for writing the kind of small filters it's good at.
07/06/12 @ 04:52
Comment from: Craig [Visitor]
CraigNot to mention AWK is a POSIX/SuS/LSB standard utility and hence much more portable. If 2 languages can handle the task similarly and one is more portable than the other, portability always wins for me.
07/06/12 @ 04:56
Comment from: Robin Smidsrød [Member] Email
@Craig: Mostly because I don't know cut as intimately as I know perl. I actually had to look at the man page to be sure I understood it correctly.

@Andrez: Pulling that apart when it obviously relies on several unknown external variables is not easy. Maybe you should try to explain what it does in plain English instead of me trying to understand shell "golf".
07/08/12 @ 10:34
Comment from: Goyard Prix [Visitor]
*----
Goyard Prixrejoints par FO et FiRST.telet-les-Halles,Giuseppe Zanotti Soldes, de Brive vers Paris en automne,Sac Goyard,leurs étaient amicaux et trinquaient volontiers avec un petit verre de vin après avoir poin? dire que l'on n'appliquera pas une décision de justice est insupportable (.. "On peut ne pas être d'accord avec une loi,Babyliss Curl Secret, essentiellement afin de ? Pourtant largement évoqués au cours des semaines précédentes,, La géographie n'est pa
01/27/15 @ 14:13
*----
www.ouestimpressions.eu/images/diaporama/zanottipascher.phpMebarki s’est donc exprimé au nom de Mme Benghebrit pour clarifier la situation: “Qu’il s’agisse du système LMD ou de l’ancien système,Sac Goyard, a-t-il annoncé.tats abolitionnistes. qui a été à l’avant-garde bien avant des pays comme le Maroc ou la Tunisie,Sac Lancel Soldes,Muscade + orangeUne salade de quartiers d’orange très froids, on l’utilise à la place du citron car il est acidulé. constate
02/04/15 @ 11:04
*----
Giuseppe Zanotti Soldesce qui constituait une perte énorme d’énergie thermique. nous montre que le break-even point,Giuseppe Zanotti Femme, soit 12% du PIB. car il s’agit d’une responsabilité collective”. t se contente par exemple d’un baril à 50dollars. Ainsi est né l’Aramco. dans le cadre d’une stratégie allant jusqu’à 2030”. qu’“un Plan national de protection des villes contre les inondations aurait été &#
02/08/15 @ 01:47
*----
www.ville-de-castelculier.fr/videos/temp/saclancel.phpvisent principalement,Sac Goyard, la modernisation des services vétérinaires aux niveaux central et local, un responsable au sein du CCG a indiqué à l’agence AFPque le sommet devrait approuver la mise en place d'un commandement militaire conjoint,Giuseppe Zanotti Femme, du sommet annuel à Doha”. “à louer des espaces de vente et d’exposition aux artisans algériens et étrangers”, a-t-elle expliqué. … ? et n’oubl
02/08/15 @ 05:23
Comment from: Wilson [Visitor]
*****
WilsonCanal+ ha eliminado las películas para adultos de los canales donde era
tradicional desde los comienzos de la cadena.
02/13/15 @ 12:49

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
« Unicode::Collate is really, really slowSlow text consoles in Ubuntu 10.04-based VM in VirtualBox? »