From owner-freebsd-questions@FreeBSD.ORG Sat Aug 23 06:32:27 2008 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 059BF106564A for ; Sat, 23 Aug 2008 06:32:27 +0000 (UTC) (envelope-from peter@boosten.org) Received: from smtpq2.groni1.gr.home.nl (smtpq2.groni1.gr.home.nl [213.51.130.201]) by mx1.freebsd.org (Postfix) with ESMTP id B80118FC18 for ; Sat, 23 Aug 2008 06:32:26 +0000 (UTC) (envelope-from peter@boosten.org) Received: from [213.51.130.190] (port=52456 helo=smtp1.groni1.gr.home.nl) by smtpq2.groni1.gr.home.nl with esmtp (Exim 4.60) (envelope-from ) id 1KWmfg-00055f-Tl; Sat, 23 Aug 2008 08:32:24 +0200 Received: from cp268254-a.landg1.lb.home.nl ([84.25.65.88]:43723 helo=ra.egypt.nl) by smtp1.groni1.gr.home.nl with esmtp (Exim 4.60) (envelope-from ) id 1KWmfg-0001we-IK; Sat, 23 Aug 2008 08:32:24 +0200 Received: from [127.0.0.1] (xp.egypt.nl [192.168.13.35]) by ra.egypt.nl (Postfix) with ESMTP id AF10739841; Sat, 23 Aug 2008 08:32:23 +0200 (CEST) Message-ID: <48AFAEF6.7090800@boosten.org> Date: Sat, 23 Aug 2008 08:32:22 +0200 From: Peter Boosten User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Walt Pawley References: <200808220759.m7M7xuh0047625@lurza.secnetix.de> In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 080822-0, 08/22/2008), Outbound message X-Antivirus-Status: Clean X-Spam-Score: 0.1 (/) Cc: Oliver Fromme , freebsd-questions@FreeBSD.ORG Subject: Re: sed/awk, instead of Perl X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Aug 2008 06:32:27 -0000 Walt Pawley wrote: > At 9:59 AM +0200 8/22/08, Oliver Fromme wrote: > > wump$ ls -l Desktop/klog > -rw-r--r-- 1 wump 1001 52753322 22 Aug 16:37 Desktop/klog > wump$ time sed "s/ .*//" Desktop/klog > kadr1 > > real 0m10.800s > user 0m10.580s > sys 0m0.250s > wump$ time perl -pe 's/ .*//' Desktop/klog > kadr2 > > real 0m0.975s > user 0m0.700s > sys 0m0.270s > wump$ cmp kadr1 kadr2 > wump$ > > Why disparity in execution speed? Beats me, but my G5's fans > started to take off running the sed command. I don't think the > Perl command took long enough to register thermally. Curious. sed outputs constantly, while perl does its output at the end at once. Try: time awk '{print $1}' Desktop/klog > kadr3 awk also outputs at the end, however is much smaller than perl (and therefore much quicker). Peter -- http://www.boosten.org