Hi all,
I have two files, abc.txt and xyz.txt. Say in abc.txt, I have a string REPLACE_HERE. And in xyz.txt, I have 2 lines:
hello
world
I want to replace the string "REPLACE_HERE" with "hello" and save it to a file named "hello" (and also repeat this step with the string "world").
Here is my bash script:
#!/bin/bash
while read p; do
perl -pe 's%REPLACE_HERE%$p%g' abc.txt > $p
done <xyz.txt
I opened "hello" and found out that the text REPLACE_HERE is replaced by nothing. Why is that so?
In reply to Perl in Bash by khiawyen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |