Skip site navigation (1)Skip section navigation (2)
Date:      Mon,  4 Feb 2002 16:58:52 -0500 (EST)
From:      Seth <seth@psychotic.aberrant.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/34620: revline: new script that may be useful.
Message-ID:  <20020204215852.860E91FC72@psychotic.aberrant.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020204215852.860E91FC72>