,
Katya
-Original Message-
From: Richard Green [mailto:gree...@uw.edu]
Sent: Saturday, February 26, 2011 10:07 PM
To: beginners@perl.org
Subject: string substitution command question
Hi Perl users, Quick question, I have a one long string with tab delimited
values separated
Ok JD thanks
On Feb 26, 2011, at 3:46 PM, John Delacour wrote:
> At 12:57 -0800 26/02/2011, Richard Green wrote:
>
>
>> > What is $gene_id?
>>> Are you by any chance using '$' at the beginning of your search pattern
>>> instead of the end?
>> I have $ to designate the end of the row
>> $
At 12:57 -0800 26/02/2011, Richard Green wrote:
> What is $gene_id?
Are you by any chance using '$' at the beginning of your search
pattern instead of the end?
I have $ to designate the end of the row
$gene_id
$gene_id designates $gene_id period.
> Why are you escaping the quote marks?
On Sat, Feb 26, 2011 at 12:56 PM, Uri Guttman wrote:
> > "PK" == Parag Kalra writes:
>
> >> why are you doing s/// against $_? by default it does that.
>
> you didn't rectify this one.
>
Oops. Missed that.
>
>
> PK> Sorry. Hope this reply is better and so as the following code:
>
> muc
> What is $gene_id?
> Are you by any chance using '$' at the beginning of your search pattern
> instead of the end?
I have $ to designate the end of the row
$gene_id
>
> Why are you escaping the quote marks?
I thought it would be easier to perform substitution without them
>
> Why is there n
> "PK" == Parag Kalra writes:
>> why are you doing s/// against $_? by default it does that.
you didn't rectify this one.
PK> Sorry. Hope this reply is better and so as the following code:
much better.
PK> use strict;
PK> use warnings;
PK> while(){
PK> $_ =~ s/NM_(\d+
--
Uri Guttman -- u...@stemsystems.com http://www.sysarch.com --
- Perl Code Review , Architecture, Development, Training, Support --
- Gourmet Hot Cocoa Mix http://bestfriendscocoa.com -
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
On Sat, Feb 26, 2011 at 12:34 PM, Uri Guttman wrote:
> > "PK" == Parag Kalra writes:
>
> PK> use strict;
> PK> use warnings;
> PK> while(){
> PK> chomp;
>
> why are you chomping here when you add in the \n later?
>
Agreed and corrected in the example at the bottom.
> PK> if
> "PK" == Parag Kalra writes:
PK> use strict;
PK> use warnings;
PK> while(){
PK> chomp;
why are you chomping here when you add in the \n later?
PK> if ($_ =~ /NM_(\d+)/){
PK> my $found = $1;
PK> $_ =~ s/$found/$found:12345/g;
many issues there. why do
At 12:06 -0800 26/02/2011, Richard Green wrote:
chr1ucscexon226488874 226488906 0.00
- . gene_id "NM_173083:12345"; transcript_id "NM_173083:12345";
chr1ucscexon226496810 226497198 0.00
- . gene_id "NM_173083:12345";
use strict;
use warnings;
while(){
chomp;
if ($_ =~ /NM_(\d+)/){
my $found = $1;
$_ =~ s/$found/$found:12345/g;
print "$_\n";
} else {
print "$_\n";
}
}
__DATA__
chr1ucscexon226488874 226488906 0.00
- . gene_id
Hi Perl users, Quick question, I have a one long string with tab delimited
values separated by a newline character (in rows)
Here is a snippet of the the string:
chr1ucscexon226488874 226488906 0.00
- . gene_id "NM_173083"; transcript_id "NM_173083";
chr1
12 matches
Mail list logo