Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: extract the tail from a string (with new lines) containing a substring

by AnomalousMonk (Archbishop)
on Jan 20, 2020 at 20:35 UTC ( [id://11111650]=note: print w/replies, xml ) Need Help??


in reply to extract the tail from a string (with new lines) containing a substring

I don't understand what you're doing. If you execute the Perl statement
    my $out = qx/grep -A 3 -B 3 xxx  file-B >> file-A/;
then  $out will be empty because output is re-directed to file-A.

c:\@Work\Perl\monks\jjmoka>dir Volume in drive C is Acer Volume Serial Number is 9480-355B Directory of c:\@Work\Perl\monks\jjmoka 01/20/2020 03:28 PM <DIR> . 01/20/2020 03:28 PM <DIR> .. 01/20/2020 03:22 PM 95 file-B 1 File(s) 95 bytes 2 Dir(s) 76,795,633,664 bytes free c:\@Work\Perl\monks\jjmoka>type file-B one two three four five six seven eight nine ten eleven twelve thirteen fourteen c:\@Work\Perl\monks\jjmoka>perl -wMstrict -MData::Dump -le "my $out = qx/grep -A 2 -B 2 four file-B >> file-A/; dd $out; " "" c:\@Work\Perl\monks\jjmoka>type file-A two three four five six -- twelve thirteen fourteen
This is under Win7, Perl 5.8.9.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11111650]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found