Skip to main content

Tools to pop lines from the head/tail of a file to stdout. Makes files into queues!

Project description

Tools to pop (remove and return) lines from files, with a variety of modes.

This allows you to treat a file on disk as a queue, or to easily strip lines from a file, and many other uses.

Example

[cmd]$ cat test # Show original file

one

two

three

four

five

[cmd]$ popHead 2 test # Remove two lines from head of the file

one

two

[cmd]$ cat test # Show that lines have been removed from file

three

four

five

Modes

The followings modes and their associated command name are given:

Head - popHead [numLines] [filename] - Removes “numLines” from the top of provided “filename”, and prints them on stdout.

Tail - popTail [numLines] [filename] - Removes “numLines” from the bottom of provided “filename”, and prints them on stdout.

Random - popRandom [numLines] [filename] - Removes “numLines” from random positions within provided “filename”, and prints to stdout in a random order.

Range - popRange [start] [stop] (optional: [step]) [filename] - Removes lines using inclusive 1-origin start, stop, and optional step, and prints to stdout. Negative numbers are supported to mean “from the end”, -1 is last line, -2 is second-to-last line.

These - popThese [line1] […lineN] [filename] - Removes specific lines given 1-origin numbers. If numbers are out of range, that number will be ommited. Lines are returned in provided order, and duplicates are allowed. Negative numbers are supported to mean “from the end”.

Module

Functionality is exposed through a module, PopLines, which can perform all the same operations.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

popLines-1.1.1.tar.gz (6.4 kB view details)

Uploaded Source

File details

Details for the file popLines-1.1.1.tar.gz.

File metadata

  • Download URL: popLines-1.1.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for popLines-1.1.1.tar.gz
Algorithm Hash digest
SHA256 c33615ae521973b5b9d43f94e464600c54d6067fe75487d5afbf6160f98c3651
MD5 907250884e836e7ff7a8dda124732fcb
BLAKE2b-256 f23f3dfeebcd933369d9a91d64f86c1418cfddb1c4903282d9bcdf08cdbd5bb9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page