Skip to content
master
Switch branches/tags
Code
This branch is 67 commits ahead, 46 commits behind nickolasburr:master.
Contribute

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Packages

No packages published