Skip to content
/ rng Public
forked from nickolasburr/rng

Copy range of lines from stdin to stdout.

License

Notifications You must be signed in to change notification settings

sjmulder/rng

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rng

Copy ranges of lines from standard input to standard output.

rng range ...

Description

rng copies the specified line ranges from standard input to standard output. Ranges can be specified as follows:

Syntax Meaning
from:to Line from through to (inclusive).
from: Line from to end of input.
:to Start of input to line end (inclusive).
: The entire input.
line Line line only.

Line numbers go up from 1 relative to the start of input, and down from -1 relative to the end of input.

Use of negative line numbers, overlapping ranges, or backtracking ranges causes the file to be buffered in its entirety.

Examples

Output lines 2-5 of a file:

rng 2:5 <file.txt

Output the first three, fifth, and last three lines of a file:

rng :3 5 -3: <file.txt

Output a file twice:

rng : : <file.txt

Building

Unix-likes:

make

# optionally
make test
make install
make uninstall

Visual C++, from the Developer Command Prompt:

nmake /f Makefile.msvc

Authors

Originally by Nickolas Burr (nickolasburr@gmail.com). Rewritten by Sijmen J. Mulder (ik@sjmulder.nl).

About

Copy range of lines from stdin to stdout.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • C 81.5%
  • Roff 11.8%
  • Makefile 6.7%