[pm-h] write to empty files

Chris Blanc cblanc at dionysius.com
Fri Jun 8 05:54:31 PDT 2018


I would write-append these lines to the file with the >> operator.

I would use this for the pathname: http://perldoc.perl.org/File/Basename.html

This might help with the timestamp:
https://www.perl.com/pub/2003/03/13/datetime.html/


On Thu, Jun 7, 2018 at 10:13 PM,  <rlharris at oplink.net> wrote:
>
> 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
> _______________________________________________
> Houston mailing list
> Houston at pm.org
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/



-- 
http://www.dionysius.com/


More information about the Houston mailing list