[pm-h] write to empty files

rlharris at oplink.net rlharris at oplink.net
Thu Jun 7 20:13:00 PDT 2018


My need is to write a string to each file in a directory (the same string,
such as, "project xyz", needs to be written to each file).  The files have
been created with "touch", run from a bash script; so the file length is
zero.  My system is Debian.

The operation "s//project xyz/" fails on a file of zero length. My Perl
skills are rusty, and I have spent more than an hour searching the web
without success, looking for a solution.

Even more useful to me would be the ability to write to each file in a
directory a string or a set of lines which include the current date and
the filename or the full filepath:

    project xyz
    documentname.tex
    2018.06.07 1950gmt

    project xyz
    /home/rlh/scratch/documentname.tex
    2018.06.07 1950gmt


More information about the Houston mailing list