The original example would remove the double-quotes only in line 1 whereas your code would remove all of them. Given, it might be what was intended anyway, but there is indeed a difference, yes?
Hi,
I would like to know if this is possible, and if so what can i do to make this work.
I would like to grep a line X from fileA and then use the output to replace a word Y in fileB.
grep "line X" fileA | sed -e 's/Y/X/g' > outfile
this statement does not work, as i do not know how to... (7 Replies)
Hi all .... vexing problem here ...
I am using sed to replace some special characters in a .txt file:
sed -e 's/_<ED>_/_355_/g;s/_<F3>_/_363_/g;s/_<E1>_/_341_/g' filename.txt
This command replaces <ED> with í , <F3> with ó and <E1> with á.
When I run the command to standard output, it works... (1 Reply)
Hi I have a file that contains lines starting with a particular string plus a Colon: I need to output all these lines but only what comes after the colon
Can you pelase assist?
Example of lines in the file:
com.ubs.f35.cashequities/cashequities: 1 2
... (5 Replies)
i have a file seperated each line seperated by newline. For example
alpha
beta
gamma
i am trying to replace the newlines to "," but dont want , present at the end of the line so i am trying the below one liner . but not sure whats wrong but its not working
cat myfile | tr -s '\n' ',' | sed... (9 Replies)
Hi All,
I have a file where I am converting newlines to comma separated values but I would like to append zero if the output is empty
Here is the command I am using
sed -n -e 'H;${x;s/\n/,/g;s/^,//;p;}' test1.txt
test1.txt will have comma seperated values but sometimes this file can be... (6 Replies)
Hi All,
I'm relatively new to Unix scripting and am trying to get my head around piping.
I'm trying to take a header record from one file and prepend it to another file. I've done this by creating several temp files but i'm wondering if there is a cleaner way to do this.
I'm thinking... (10 Replies)
I have a file example.txt as follows :SomeTextGoesHere
$$TODAY_DT=20140818
$$TODAY_DT=20140818
$$TODAY_DT=20140818I need to automatically update the date (20140818) in the above file, by getting the new date as argument, using a shell script.
(It would even be better if I could pass... (5 Replies)
I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place.
What I need
The following command is placed at the prompt:
TICLI... (4 Replies)
Hello.
Ive spent probably a hour on this problem, and cant figure it out.
Let me explain the problem.
I run head -n5 datasets/q13data.txt and get this :
$$001011<-:::$$<-::: '
GreenWHITE<-::3.1415<-:::"BLACK
fubar<-:::phi<-:::foochi
$$$Yellow->:::'<-:::VOIDTue
taochi->::$->:::Blue"... (12 Replies)
Hi,
I am working on a script where I am adding adding colors to few of the info in the output.
Now , after that is done , I see colour codes in log files which I don't want to see.:mad::mad::mad::mad:
So , I tried using sed command in script as below which gives me o/p (new.log) as blank file... (7 Replies)
Discussion started by: Dream4649
7 Replies
LEARN ABOUT CENTOS
tap::parser::sourcehandler::executable
TAP::Parser::SourceHandler::Executable(3) User Contributed Perl Documentation TAP::Parser::SourceHandler::Executable(3)NAME
TAP::Parser::SourceHandler::Executable - Stream output from an executable TAP source
VERSION
Version 3.28
SYNOPSIS
use TAP::Parser::Source;
use TAP::Parser::SourceHandler::Executable;
my $source = TAP::Parser::Source->new->raw(['/usr/bin/ruby', 'mytest.rb']);
$source->assemble_meta;
my $class = 'TAP::Parser::SourceHandler::Executable';
my $vote = $class->can_handle( $source );
my $iter = $class->make_iterator( $source );
DESCRIPTION
This is an executable TAP::Parser::SourceHandler - it has 2 jobs:
1. Figure out if the TAP::Parser::Source it's given is an executable
command ("can_handle").
2. Creates an iterator for executable commands ("make_iterator").
Unless you're writing a plugin or subclassing TAP::Parser, you probably won't need to use this module directly.
METHODS
Class Methods
"can_handle"
my $vote = $class->can_handle( $source );
Only votes if $source looks like an executable file. Casts the following votes:
0.9 if it's a hash with an 'exec' key
0.8 if it's a .bat file
0.75 if it's got an execute bit set
"make_iterator"
my $iterator = $class->make_iterator( $source );
Returns a new TAP::Parser::Iterator::Process for the source. "$source->raw" must be in one of the following forms:
{ exec => [ @exec ] }
[ @exec ]
$file
"croak"s on error.
"iterator_class"
The class of iterator to use, override if you're sub-classing. Defaults to TAP::Parser::Iterator::Process.
SUBCLASSING
Please see "SUBCLASSING" in TAP::Parser for a subclassing overview.
Example
package MyRubySourceHandler;
use strict;
use vars '@ISA';
use Carp qw( croak );
use TAP::Parser::SourceHandler::Executable;
@ISA = qw( TAP::Parser::SourceHandler::Executable );
# expect $handler->(['mytest.rb', 'cmdline', 'args']);
sub make_iterator {
my ($self, $source) = @_;
my @test_args = @{ $source->test_args };
my $rb_file = $test_args[0];
croak("error: Ruby file '$rb_file' not found!") unless (-f $rb_file);
return $self->SUPER::raw_source(['/usr/bin/ruby', @test_args]);
}
SEE ALSO
TAP::Object, TAP::Parser, TAP::Parser::IteratorFactory, TAP::Parser::SourceHandler, TAP::Parser::SourceHandler::Perl,
TAP::Parser::SourceHandler::File, TAP::Parser::SourceHandler::Handle, TAP::Parser::SourceHandler::RawTAP
perl v5.16.3 2013-05-02 TAP::Parser::SourceHandler::Executable(3)