Search Results

Search: Posts Made By: sprinner
17,700
Posted By bartus11
As for the "\1", it stores the first match...
As for the "\1", it stores the first match contained in "()" brackets. To modify your file directly use this: perl -i -0pe 's/Raining(.*\n.*TODAY)/Sunny\1/g;s/(TODAY.*\n.*)Reading/\1Hiking/g' file
17,700
Posted By Skrynesaver
man perlrun -p causes Perl to assume the...
man perlrun
-p causes Perl to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed:
LINE:
while (<>) {
... ...
17,700
Posted By bartus11
Try: perl -0pe...
Try: perl -0pe 's/Raining(.*\n.*TODAY)/Sunny\1/g;s/(TODAY.*\n.*)Reading/\1Hiking/g' file
Showing results 1 to 3 of 3

 

Featured Tech Videos

All times are GMT -4. The time now is 11:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy