re: shell editor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--

_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list



[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]