From oracle-l-bounce@freelists.org Tue Apr 5 17:42:19 2005 Return-Path: Received: from air891.startdedicated.com (root@localhost) by orafaq.com (8.12.10/8.12.10) with ESMTP id j35MgJJ6023522 for ; Tue, 5 Apr 2005 17:42:19 -0500 X-ClientAddr: 206.53.239.180 Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180]) by air891.startdedicated.com (8.12.10/8.12.10) with ESMTP id j35MgJem023518 for ; Tue, 5 Apr 2005 17:42:19 -0500 Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B53B4911B4; Tue, 5 Apr 2005 16:40:16 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18467-05; Tue, 5 Apr 2005 16:40:16 -0500 (EST) Received: from turing (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 37E2B91114; Tue, 5 Apr 2005 16:40:16 -0500 (EST) Message-ID: From: Kevin Lange To: oracle-l@freelists.org Subject: RE: Very Simply KSH Question Date: Tue, 5 Apr 2005 16:38:28 -0500 MIME-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 18101 X-ecartis-version: Ecartis v1.0.0 Sender: oracle-l-bounce@freelists.org Errors-To: oracle-l-bounce@freelists.org X-original-sender: klange@ppoone.com Precedence: normal Reply-To: klange@ppoone.com X-list: oracle-l X-Virus-Scanned: by amavisd-new-20030616-p9 (Debian) at avenirtech.net X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on air891.startdedicated.com X-Spam-Status: No, hits=0.0 required=5.0 tests=AWL autolearn=ham version=2.60 X-Spam-Level: Took you long enough..... -----Original Message----- From: Jared Still [mailto:jkstill@gmail.com] Sent: Tuesday, April 05, 2005 4:36 PM To: Ethan.Post@ps.net Cc: Kevin Lange; carmen.rusu@rrc.state.tx.us; mgogala@allegientsystems.com; oracle-l@freelists.org Subject: Re: Very Simply KSH Question I can't take it any more. Convert to Perl. Now. ------------- #!/usr/bin/perl while() { my ($junk,$x,$y,$z) = split(/\|/); print qq{ X: $x Y: $y Z: $z }; } __DATA__ KEY|FOO|WRECK|CAR On Apr 5, 2005 9:03 PM, Post, Ethan wrote: > list is in file > > KEY|FOO|WRECK|CAR > > need to assign field 2 to X, 3 to Y... > > I hate... > > X=3D$(cat file | grep "^FOO" | awk -F"|" '{ print $2}') > Y=3D$(cat file | grep "^FOO" | awk -F"|" '{ print $3}') > ... > > in many scripts I... > > grep "^FOO" file | awk -F"|" '{ print $2" "$3" "$$ }' | read X Y Z -- Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist -- http://www.freelists.org/webpage/oracle-l