From owner-freebsd-questions Tue Feb 5 6:47:43 2002 Delivered-To: freebsd-questions@freebsd.org Received: from joescanner.com (snjpca1-ar1-162-190.snjpca1.dsl.gtei.net [4.43.162.190]) by hub.freebsd.org (Postfix) with ESMTP id 6CB8137B423 for ; Tue, 5 Feb 2002 06:47:38 -0800 (PST) Received: from hood.wstein.com (hood.wstein.com [192.168.201.89]) by shasta.wstein.com (8.11.6/8.11.6) with ESMTP id g158apD38406 for ; Tue, 5 Feb 2002 00:36:51 -0800 (PST) (envelope-from joes@joescanner.com) Date: Tue, 5 Feb 2002 00:36:54 -0800 (Pacific Standard Time) From: Joseph Stein Reply-To: Joseph Stein To: freebsd-questions@freebsd.org Subject: awk- make that sed- question Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Apologies if this is not the appropriate forum for this, but... An interesting problem. I am massaging some "strangely" formatted text output using sed and awk. The problem I am encountering is that some output lines are longer than 256 characters. I originally thought I was running into a problem in awk, but it turns out that the data lines are being truncated by sed. I find no mention of a maximum line length in the manual page for sed, and I'm sure there is a way to defeat the problem. The sed/awk pipeline I'm using looks like this: sed -e 's/"//g' -e 's/;/,/g' -e 's/\(<0[0-9A-F][0-9A-F][0-9A-F]\),/\1:/g' -e 's/\([0-9]\),\([0-9]\)/\1\2/' filename | awk ' { FS="," ; printf "\n%s\n", NF; print length($0); for (i=0; i<=NF; i++) print i ": " $i; print $NF; } ' While I realize this is pretty ugly, it does what I need: * remove all double quotes from input * replace ; with , * change a comma in data that looks like <0372, 1123> to a colon * remove the thousands separator in a number (231,445 => 231445) The awk script is not exactly what I want right this second, but it presents the data in the format I wish it to (almost) and I can tweak that myself. Any ideas? joe --- Joseph Stein (KD7MLG) joes at joescanner dot com Beaverton, OR USA To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message