Post 859900 by anthk@bsd.network
(DIR) More posts by anthk@bsd.network
(DIR) Post #858571 by ckeen@vernunftzentrum.de
2018-10-30T13:48:54.208167Z
0 likes, 0 repeats
@kensanata kindly told me that some of my #gopher files have been missing a trailing newline thus are not real text files in the unix sense.Here's a nice oneliner to fix this:for f in *.txt; do tail -c1 "$f" | read -r _ || echo >> $f; done
(DIR) Post #858572 by anthk@bsd.network
2018-10-30T14:48:00Z
0 likes, 0 repeats
@ckeen @kensanata Trailing as appended? find *.txt -exec printf "\n" >> {} \;
(DIR) Post #859899 by ckeen@vernunftzentrum.de
2018-10-30T14:50:43.342215Z
0 likes, 0 repeats
@anthk @kensanata That will add a trailing newline unconditionally even for files that already have it. No?
(DIR) Post #859900 by anthk@bsd.network
2018-10-30T16:05:02Z
0 likes, 0 repeats
@ckeen @kensanata ok, then with an AWK script and a sh for loop (or find) you could check if the last NR is the same as "\n", if not, append "\n" to it.