Murali_Newbee has asked for the wisdom of the Perl Monks concerning the following question:
Hello my friends
foreach(@{$arr_ref}) { @hlist=(@$_); foreach my $lines(@hlist){ open (my $file, '>>', 'hpart.txt') or die "Could not open file +: $!"; my $output = `my system command`; die "$!" if $?; print $file $output; } }
this code takes a list and executes a system command which gives output in hpart.txt as following :
something something$ something12
something something something
_id:ac43434
something something something something
something something$ something12
something something something
_id:ci2784
something something something something
etc etc
desired ouput:
ac4334
ci2784
as far as now, after my script executes, i grep the output file i.e hpart.txt with "_id:" and get the list and clear the "_id:" in editplus
But how can i redirect only those values to the output file??
Thank you in advance my friends
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Redirect a substring/desired values from a System output to a file in Perl
by Discipulus (Canon) on Jul 27, 2018 at 08:44 UTC | |
by Murali_Newbee (Novice) on Jul 31, 2018 at 14:40 UTC | |
|
Re: Redirect a substring/desired values from a System output to a file in Perl
by haukex (Archbishop) on Jul 27, 2018 at 08:57 UTC | |
by Murali_Newbee (Novice) on Jul 31, 2018 at 11:34 UTC | |
|
Re: Redirect a substring/desired values from a System output to a file in Perl
by hippo (Archbishop) on Jul 27, 2018 at 09:03 UTC |