From owner-freebsd-bugs Mon Feb 4 14: 0:19 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 23C6337B436 for ; Mon, 4 Feb 2002 14:00:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g14M02301069; Mon, 4 Feb 2002 14:00:02 -0800 (PST) (envelope-from gnats) Received: from psychotic.aberrant.org (psychotic.aberrant.org [66.92.161.103]) by hub.freebsd.org (Postfix) with ESMTP id CA3FD37B423 for ; Mon, 4 Feb 2002 13:58:55 -0800 (PST) Received: by psychotic.aberrant.org (Postfix, from userid 1001) id 860E91FC72; Mon, 4 Feb 2002 16:58:52 -0500 (EST) Message-Id: <20020204215852.860E91FC72@psychotic.aberrant.org> Date: Mon, 4 Feb 2002 16:58:52 -0500 (EST) From: Seth Reply-To: Seth To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/34620: revline: new script that may be useful. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 34620 >Category: bin >Synopsis: revline: new script that may be useful. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Feb 04 14:00:02 PST 2002 >Closed-Date: >Last-Modified: >Originator: Seth >Release: FreeBSD 4.5-RELEASE i386 >Organization: >Environment: System: FreeBSD psychotic.aberrant.org 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Tue Jan 29 15:59:13 EST 2002 seth@psychotic.aberrant.org:/usr/src/sys/compile/KERNEL-A i386 >Description: A nice utility that will reverse the lines in a file (or group of files, or stdin) and display on stdout. It's a simple one-liner, but I'm surprised it's not included in the base dist. It works very well for me in /etc/periodic scripts, since it will output the most recent information first when scans are done on multiple files. Yes, tac has this functionality, but it's not included in base distribution. >How-To-Repeat: script is quite simple: #!/usr/bin/awk -f # /usr/local/bin/revline # revline. An awk script that will reverse the order of lines in a file. # see man page for details. { line[i++] = $0 } END { while (i) print line[--i]; } Manpage: .Dd Feb 4, 2002 .Dt REVLINE 1 .Os .Sh NAME .Nm revline .Nd reverse the order of lines in a file .Sh SYNOPSIS .Nm .Op Ar file ... .Sh DESCRIPTION The .Nm utility copies the specified files to the standard output, reversing the order of lines. If multiple files are specified, they are all read before processing takes place. If no files are specified, the standard input is read. >Fix: Make available as /usr/local/bin/revline. Use where appropriate. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message