shell editor

Linux for blind general discussion blinux-list at redhat.com
Tue Sep 26 15:37:15 UTC 2017


No, fmt is not the same as fold.  The fmt command in my testing failed to 
break lines but fold got the line breaks correct.
Also, truncate is back along with the tr command to change those binary 
zeros to spaces.  Easier approach.  This one so far as I can tell now 
works.  I'll put a loop in the script and a math test on the edited file 
to ensure character limit entered by user is not exceeded in a little 
while.
Cut here.

#!/usr/bin/env bash
# file: fcl.sh - file with character limit script.
echo -c "character limit for file:"
read
lim=$REPLY
echo -c "file name to edit"
read
ef=$REPLY
truncate -s $lim $ef
tr "\0" "." < $ef > $ef.f
mv $ef.f $ef
fold -80 < $ef > $ef.f
mv $ef.f $ef
echo "remember only change lines in $ef to stay inside character limits."
nano $ef
wc -c $ef

-- 




More information about the Blinux-list mailing list