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
*****
how to Get your own Domain nameI do not even understand how I finished up right here, however I thought this put up was once great.

I do not know who you're but definitely you're going to a famous blogger in case you aren't already.
Cheers!
06/11/14 @ 04:12
Comment from: www.cad23d.pl [Visitor]
*****
www.cad23d.plOften we hear experts in the media that report a particular stock
is going to soar and now will be the time to acquire. This business is
going to be operated from your owner's home and will be done entirely about the
internet. The business degree raises one's social standing: in short,
it opens for you personally doors that could have otherwise remained closed for your requirements.
06/16/14 @ 05:21
Comment from: avvampai [Visitor]
*****
avvampaiHe decided to tell me around 60 days that he used to be a drug dealer; his father moved in with him because he was an alcoholic; his mother
was in a mental institution because of abuse from his father;
his sister was dying of a deadly disease; and he wanted me to buy him a cell phone and give him $20 because
he used his money to pay for his sister's grocery bill.

Similarly, if he's telling the world that cigars and scotch are his favourite nightcap, and
you're as anti-smoking, wine-loving as it comes, just let him know.

Paid subscribers can even exchange emails and messages.
06/23/14 @ 20:03
Comment from: NTT strona [Visitor]
*****
NTT stronaHighly descriptive post, I liked that bit. Will there be a part
2?
06/25/14 @ 16:34
Comment from: Web Hosting Secret [Visitor]
*****
Web Hosting SecretI leave a comment whenever I appreciate a artticle
on a website or I have something to contribute too
the discussion. It's caued by the fire communicated in the article I looked at.
And on this article Using perl instead of awk in my one-liner.
I was excited enough to poswt a thought :-P I actually do have a couple of questions for
you if you tend not to mind. Could it be simply me or does
it look lie like some of these remarks come across as
if they aare left by brain dead individuals? :-P And, iif you are posting on other sites, I'd likke
to keep up with you. Could you list the complete urls off your
shared sites like your Facebook page, twitter feed, or linkedin profile?
07/04/14 @ 23:59
Comment from: www.turbud.com.pl [Visitor]
*****
www.turbud.com.plUsing ingenious technology and innovation the
Romans made an Empire that withstood the test of energy.
Investors are there to help you the entrepreneur
and to get a make money from their investment
from the entrepreneurs company. ll hold the practical guidance
you'll need on how to begin a concierge business''.
07/07/14 @ 13:02
Comment from: Randy [Visitor]
*****
RandyThanks for every other informative web site. The place else could I am getting that type of info written in such a perfect method?
I have a challenge that I am just now running on, and I've been on the look out for such information.
07/09/14 @ 21:31
Comment from: hearthstone gold bot [Visitor]
*****
hearthstone gold botIt's hard to find well-informed people about
this subject, however, you sound like you know what you're talking about!
Thanks
07/10/14 @ 02:41
Comment from: getoutsource.pl [Visitor]
*****
getoutsource.plOften we hear experts on television that report a particular stock is planning to soar and now will
be the time to get. The the fact is, people join MLM opportunities due to who introduced them.
it could also be employed for headhunting and employment.
07/10/14 @ 13:32
Comment from: best survival foods [Visitor]
*****
best survival foodsVery good write-up. I absolutely appreciate this
website. Keep writing!
07/12/14 @ 23:06
*****
free wordpress hostingI have learn a few excellent stuff here. Certainly value bookmarking for
revisiting. I surprise how a lot effort you put to make this kind of great informative
site.
07/22/14 @ 16:08

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? »