I'm not familiar with touch, but can't you just:
1) open the file for appending (>>)
2) print FILEHANDLE "project xyz";
Example:
open OUT, ">>", $outfile or die "$0: open $outfile: $!"; # Or use the
new way of opening a file
print OUT "project xyz";
Mike
On 6/7/2018 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/
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/