From the Windows command prompt I generate a text file of all the files in a directory:
dir c:logfiles /B > config.txt
Output:
0001_832ec657.log
0002_a7c8eafc.log
I need to feed the "config.txt" file to another executable, but before I do so, I need to modify the file to add some additional information that the executable needs. So I use the following command:
perl -p -i.bak -e 's/log/log,XYZ/g' config.txt
I'm expecting the result to be:
0001_832ec657.log,XYZ
0002_a7c8eafc.log,XYZ
However, the "config.txt" file is not modified. Using the "-w" option, I get the warning message:
Useless use of a constant in void context at -e line 1.
What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…