A
amerar
Hi,
I'm trying to use the -pi switches to replace some strings in a file.
However, I'm getting some very strange results.
My test file looks like this:
daily_rank.sh|22:30|22:31|22:35|Y
dart_process.sh|17:45|17:45|14:46|Y
prft_trck.sh|7:30|7:30|7:46|Y
Here is my command line:
perl -pi -e "s/$x/$y/;" job_control
$x = daily_rank.sh|22:30|22:31|22:35|Y
$y = daily_rank.sh|22:30|14:13|22:35|N
After the Perl command executes, my file looks like this:
daily_rank.sh|22:30|14:13|22:35|N|22:30|22:31|22:35|Y
dart_process.sh|17:45|17:45|14:46|daily_rank.sh|22:30|14:13|22:35|N
prft_trck.sh|7:30|7:30|7:46|daily_rank.sh|22:30|14:13|22:35|N
This is not what I expected. I excpected just the first line to be
replaced.
This may have to do with quotes? Or maybe it has to do with the pipe
being a special character? But, I've been at it for hours and was
looking for a bit of help?
Thanks!
I'm trying to use the -pi switches to replace some strings in a file.
However, I'm getting some very strange results.
My test file looks like this:
daily_rank.sh|22:30|22:31|22:35|Y
dart_process.sh|17:45|17:45|14:46|Y
prft_trck.sh|7:30|7:30|7:46|Y
Here is my command line:
perl -pi -e "s/$x/$y/;" job_control
$x = daily_rank.sh|22:30|22:31|22:35|Y
$y = daily_rank.sh|22:30|14:13|22:35|N
After the Perl command executes, my file looks like this:
daily_rank.sh|22:30|14:13|22:35|N|22:30|22:31|22:35|Y
dart_process.sh|17:45|17:45|14:46|daily_rank.sh|22:30|14:13|22:35|N
prft_trck.sh|7:30|7:30|7:46|daily_rank.sh|22:30|14:13|22:35|N
This is not what I expected. I excpected just the first line to be
replaced.
This may have to do with quotes? Or maybe it has to do with the pipe
being a special character? But, I've been at it for hours and was
looking for a bit of help?
Thanks!