bb_get_list - ampinzonv/BB3 GitHub Wiki
bb_get_list
Function: Process a list of items and return a unique, sorted list or a frequency table.
๐ Description
This function reads a list of items (one per line) from a file or STDIN and outputs either:
- A unique sorted list of items, or
- A table showing the frequency and relative percentage of each item (if
--frequency
is used).
๐ฅ Input
- A plain text file where each line is a list item.
- STDIN is supported via
--input -
.
๐ค Output
- By default: a sorted list of unique items.
- With
--frequency
: a table with columns: item, count, percent.
๐งช Examples
List unique items:
bb_get_list --input names.txt
Show frequency and percentages:
bb_get_list --input names.txt --frequency
Pipe input and save output:
cat names.txt | bb_get_list --input - --outfile sorted.txt
โ๏ธ Usage
bb_get_list --input FILE [--outfile FILE] [--frequency] [--quiet] [--force]
๐งต Options
Option | Description |
---|---|
--input FILE |
Input file or - for STDIN (required) |
--outfile FILE |
Output file (default: STDOUT) |
--frequency |
Show item counts and relative percentages |
--quiet |
Suppress messages |
--force |
Overwrite output file if it exists |
๐ Notes
- Output is sorted alphabetically by default.
- Frequencies are based on non-empty lines only.