From seth@psychotic.aberrant.org  Mon Feb  4 13:58:57 2002
Return-Path: <seth@psychotic.aberrant.org>
Received: from psychotic.aberrant.org (psychotic.aberrant.org [66.92.161.103])
	by hub.freebsd.org (Postfix) with ESMTP id CA3FD37B423
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <seth@psychotic.aberrant.org>
Reply-To: Seth <seth@psychotic.aberrant.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: revline: new script that may be useful.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         34620
>Category:       bin
>Synopsis:       revline: new script that may be useful.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 04 14:00:02 PST 2002
>Closed-Date:    Tue Feb 5 01:35:47 PST 2002
>Last-Modified:  Tue Feb 05 01:36:33 PST 2002
>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:

From: Sheldon Hearn <sheldonh@starjuice.net>
To: Seth <seth@psychotic.aberrant.org>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/34620: revline: new script that may be useful. 
Date: Tue, 05 Feb 2002 00:17:19 +0200

 On Mon, 04 Feb 2002 16:58:52 EST, Seth wrote:
 
 > >Number:         34620
 > >Category:       bin
 > >Synopsis:       revline: new script that may be useful.
 
 Between rev(1) and sort(1)'s -r option, I think we've got it covered,
 both reversing text on a line and reversing lines. :-)
 
 Ciao,
 Sheldon.

From: "Crist J. Clark" <cristjc@earthlink.net>
To: Sheldon Hearn <sheldonh@starjuice.net>
Cc: bug-followup@FreeBSD.ORG
Subject: Re: bin/34620: revline: new script that may be useful.
Date: Mon, 4 Feb 2002 16:50:54 -0800

 On Mon, Feb 04, 2002 at 02:20:03PM -0800, Sheldon Hearn wrote:
 >  On Mon, 04 Feb 2002 16:58:52 EST, Seth wrote:
 >  
 >  > >Number:         34620
 >  > >Category:       bin
 >  > >Synopsis:       revline: new script that may be useful.
 >  
 >  Between rev(1) and sort(1)'s -r option, I think we've got it covered,
 >  both reversing text on a line and reversing lines. :-)
 
 Not really. rev(1) does,
 
   $ echo 'Reverse this.' | rev
   .siht esreveR
 
 And sort(1) sorts and then prints in reverse. This is not the same.
 
 There are two very good reasons not to add this. As the original
 poster points out, it is trivial to script in awk(1), perl(1), sh(1),
 or whatever. And the command that _really_ does what he wants is,
 
   $ tail -r
 
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Feb 5 01:35:47 PST 2002 
State-Changed-Why:  
Closed as per the standard "one-liner rejected" policy. 

But thanks for your interest in improving FreeBSD. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34620 
>Unformatted:
