Hmmm... I think it might. Thanks for your help. I will -pass it on and have her try it.
Thanks for the help! Have a great day!
Thanks,
Jeffrey A. McCright, A+ 816-210-3107 jmccright@hotmail.com
From: brad@bradandkim.net To: kclug@kclug.org Subject: Re: Need script help. Date: Thu, 21 Jun 2007 09:05:37 -0500 (CDT) MIME-Version: 1.0 Received: from kclug.org ([139.146.133.42]) by bay0-mc2-f19.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444); Thu, 21 Jun 2007 07:05:45 -0700 Received: from localhost (localhost.localdomain [127.0.0.1])by kclug.org (Postfix) with ESMTP id 52334704E94;Thu, 21 Jun 2007 09:05:43 -0500 (CDT) Received: from kclug.org ([127.0.0.1])by localhost (kclug.org [127.0.0.1]) (amavisd-new, port 10024)with ESMTP id A1aRDoqNnn3x; Thu, 21 Jun 2007 09:05:42 -0500 (CDT) Received: from kclug.org (localhost.localdomain [127.0.0.1])by kclug.org (Postfix) with ESMTP id 610CC704E90;Thu, 21 Jun 2007 09:05:41 -0500 (CDT) Received: from localhost (localhost.localdomain [127.0.0.1])by kclug.org (Postfix) with ESMTP id 108E5704E8Ffor kclug@kclug.org; Thu, 21 Jun 2007 09:05:40 -0500 (CDT) Received: from kclug.org ([127.0.0.1])by localhost (kclug.org [127.0.0.1]) (amavisd-new, port 10024)with ESMTP id 1-JS7g4XOZBL for kclug@kclug.org;Thu, 21 Jun 2007 09:05:39 -0500 (CDT) Received: from mail.bradandkim.net (110.47.124.24.cm.sunflower.com[24.124.47.110]) by kclug.org (Postfix) with ESMTP id C936B704E8Cfor kclug@kclug.org; Thu, 21 Jun 2007 09:05:39 -0500 (CDT) Received: from localhost (localhost.localdomain [127.0.0.1])by mail.bradandkim.net (Postfix) with ESMTP id 4320EE0159Afor kclug@kclug.org; Thu, 21 Jun 2007 09:05:39 -0500 (CDT) Received: from mail.bradandkim.net ([127.0.0.1])by localhost (mail.bradandkim.net [127.0.0.1]) (amavisd-new, port 10024)with ESMTP id 09804-09 for kclug@kclug.org;Thu, 21 Jun 2007 09:05:37 -0500 (CDT) Received: from webmail.bradandkim.net (localhost.localdomain [127.0.0.1])by mail.bradandkim.net (Postfix) with ESMTP id C5B25E01593for kclug@kclug.org; Thu, 21 Jun 2007 09:05:37 -0500 (CDT) Received: from 129.237.174.144(SquirrelMail authenticated user brad@bradandkim.net)by webmail.bradandkim.net with HTTP;Thu, 21 Jun 2007 09:05:37 -0500 (CDT) X-Message-Info: txF49lGdW40IdOmWLQfKf4GrcYHusV9u5v5rQzZwOdtJgs5qAHICYz3nwSl9+Rfe X-Original-To: kclug@kclug.org Delivered-To: kclug@kclug.org References: BAY108-F211211EAC6E9F4C414DE23A8100@phx.gbl User-Agent: SquirrelMail/1.4.10a-1.fc6 X-Virus-Scanned: Maia Mailguard 1.0.1 X-BeenThere: kclug@kclug.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: KCLUG mailing list <kclug.kclug.org> List-Unsubscribe: http://kclug.org/mailman/listinfo/kclug,mailto:kclug-request@kclug.org?subject=unsubscribe List-Archive: http://kclug.org/pipermail/kclug List-Post: mailto:kclug@kclug.org List-Help: mailto:kclug-request@kclug.org?subject=help List-Subscribe: http://kclug.org/mailman/listinfo/kclug,mailto:kclug-request@kclug.org?subject=subscribe Errors-To: kclug-bounces@kclug.org Return-Path: kclug-bounces@kclug.org X-OriginalArrivalTime: 21 Jun 2007 14:05:46.0130 (UTC) FILETIME=[43602F20:01C7B40D]
All,
I have a friend who needs to run a shell script to process data in a
space
or comma delimited file. I think SED or AWK may be needed here, but I don't program so I need help. The ASCII File structure is similar to the following:
Lastname Firstname internalphonenumber externalphonenumber
phoneextention
MACaddress ... Lastname Firstname internalphonenumber externalphonenumber
phoneextention
MACaddress ... Lastname Firstname internalphonenumber externalphonenumber
phoneextention
MACaddress ... Lastname Firstname internalphonenumber externalphonenumber
phoneextention
MACaddress ...
The fields are variable length.
My friend needs to be able to plug in commands in this script file so
that
she can have something like:
{command} Lastname {command} Firstname {command} internalphonenumber {command} externalphonenumber ...
etc...
The file contains around 1400 records or more. Each record needs to be processed as above.
Does this make sense? Any ideas?
Thanks,
Jeffrey A. McCright, A+ 816-210-3107 jmccright@hotmail.com
I think awk would be best for this. Something like
cat <file> |awk '{ print "<command>" " " $1 " " <command> " " $2}' >
<newfile>
When you cat the file and pipe it into awk, awk will look at it line by line and set $1 as the first field, $2 as the second field and so forth. By default awk uses spaces and/or tabs as the field delimiter but that can be changed. In the above command, the " " is just to print a space between your command and the argument. Hope that helps.
Brad Crotchett brad@bradandkim.net http://www.bradandkim.net
Kclug mailing list Kclug@kclug.org http://kclug.org/mailman/listinfo/kclug
_________________________________________________________________ Get a preview of Live Earth, the hottest event this summer - only on MSN http://liveearth.msn.com?source=msntaglineliveearthhm