config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 8d3b30cf54769a2480d805090dead0c4a35eb562
parent 6ae9391356bccac12f5fec1cb7a656db5eb9f32b
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun, 14 Feb 2021 21:06:57 -0800

Add `len' script to output lines of a certain length

Diffstat:
Amodules/scripts/.local/bin/len | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/modules/scripts/.local/bin/len b/modules/scripts/.local/bin/len @@ -0,0 +1,20 @@ +#!/bin/sh +# Copywrite 2021 Jacob R. Edwards +# License: GPLv3 +# +# len -- filter lines of a specific length +# +# This is actually a simple wrapper around awk(1), so the `operand' +# argument is an awk(1) comparison operator. Note that it does not +# take file arguments. + +case $# +in +(1) + exec awk "length() == $1";; +(2) + exec awk "length() $1 $2";; +(*) + printf 'usage: %s [[operand] operator]\n' `basename $0` 1>&2 + exit 1 +esac