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, <[email protected]> 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 > [email protected] > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ -- http://www.dionysius.com/ _______________________________________________ Houston mailing list [email protected] http://mail.pm.org/mailman/listinfo/houston Website: http://houston.pm.org/
