free software resistance
the cost of computing freedom is eternal vigilance
### addb.fig
*originally posted:* nov 2023
### update:
addb.fig has been updated to 0.2. the only changes are that proginf now says its version 0.2, and the "minus 1" in " nolines cmd mid 1 1 val minus 1" has been changed, to "minus .5".
this is to prevent logic that makes the parameters optional from setting 1 consecutive line to 0. it should now be possible to add a blank after every line if you want to.
i often want to add a certain number of blank lines- usually one or two- between lines of text output from a file or other program. you could do this fairly easily with awk of course.
```
proginf = "addb 0.2, nov 2023 mn"
usage = "cat some-output | ./addb.fig.py $consecutive_lines $number_of_blanks"
### example: ls | ./addb 5 1 # every five lines, add a blank line
### existing blank lines in text are displayed without being counted
cmd command
try
nolines cmd mid 1 1 val minus .5
except
nolines 0
next
try
noblank cmd mid 2 1 val
except
noblank 1
next
ifequal nolines 0
noblank 0
next
p arrstdin
c 0
forin each p
rt each rtrim
ifequal rt ""
now each print
else
now c plus 1 swap now c
now each print
ifmore c nolines
for rpt 1 noblank 1
now "" print
next
c 0
next
next
next
# license: 0-clause bsd
#
# 2023 mn
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
license: 0-clause bsd
```
# 2019, 2020, 2021, 2022, 2023
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org