Re: Regular Expression Help.

2015-03-24 Thread Shlomi Fish
Hi Frank, On Wed, 25 Mar 2015 10:31:40 +0530 Frank Vino wrote: > Hi Team, > > How to understand Regular Expression in a easy way? > This page has links to some recommended tutorials about learning regular expressions: http://perl-begin.org/topics/regular-expressions/ *NOTE*: I originated pe

Re: Regular Expression Help.

2015-03-24 Thread Rahul Gojame
Frank, Just go through below site, it helps to build regex and test same easily. http://www.regexr.com/ ~Rahul On Wed, Mar 25, 2015 at 10:42 AM, Akshay Mohit wrote: > Just start using it and you will find it very easy to understand. > > -Akshay > > On Wed, Mar 25, 2015 at 10:31 AM, Frank Vino

Re: Regular Expression Help.

2015-03-24 Thread Akshay Mohit
Just start using it and you will find it very easy to understand. -Akshay On Wed, Mar 25, 2015 at 10:31 AM, Frank Vino wrote: > Hi Team, > > How to understand Regular Expression in a easy way? > > Thanks, > Frank >

Regular Expression Help.

2015-03-24 Thread Frank Vino
Hi Team, How to understand Regular Expression in a easy way? Thanks, Frank

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Jim Gibson
> On Mar 24, 2015, at 7:27 AM, Anirban Adhikary > wrote: > > Hi Jim > > In your code there is some hard coded value [ /RXMOI:MO=RXOTRX > But I can't put any hard coded value since I use this code as a function and > pass the filename as an argument. > As you can see in my code there is no har

Re: Is DBD installed with DBI?

2015-03-24 Thread Shlomi Fish
Hi Sherman, On Tue, 24 Mar 2015 08:23:07 -0600 Sherman Willden wrote: > Thank you, Shlomi. I am on Ubuntu when I try to install. I am looking at > the links and I see there is also a DBD::msql. I will try that. > DBD::mSQL is part of https://metacpan.org/release/Msql-Mysql-modules (whose last

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Anirban Adhikary
Hi Jim In your code there is some hard coded value [ * /RXMOI:MO=RXOTRX* But I can't put any hard coded value since I use this code as a function and pass the filename as an argument. As you can see in my code there is no hard coded value. Best Regards Anirban. On Tue, Mar 24, 2015 at 7:44 PM,

Re: Is DBD installed with DBI?

2015-03-24 Thread Sherman Willden
Thank you, Shlomi. I am on Ubuntu when I try to install. I am looking at the links and I see there is also a DBD::msql. I will try that. Sherman On Tue, Mar 24, 2015 at 1:37 AM, Shlomi Fish wrote: > Hi Sherman, > > On Mon, 23 Mar 2015 14:42:54 -0600 > Sherman Willden wrote: > > > I am trying t

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Simon Reinhardt
Am 24.03.2015 um 14:03 schrieb Shlomi Fish: > This can be more idiomatically written as: > > $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] I agree, a sort { $a->[0] <=> $b->[0] or $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] } is certainly more readable than the C-style sort {

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Jim Gibson
> On Mar 24, 2015, at 3:42 AM, Anirban Adhikary > wrote: > > Hi List > I have a file like this. > RXMOI:MO=RXOTRX-473-0,SC=0,DCP1=178,SIG=SCCONC,DCP2=179&&186,TEI=0; > RXMOI:MO=RXOTRX-473-5,SC=0,DCP1=223,SIG=SCCONC,DCP2=224&&231,TEI=5; > RXMOI:MO=RXOTRX-473-1,SC=0,DCP1=187,SIG=SCCONC,DCP2=188&&

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Shlomi Fish
Hi Simon, thanks for helping Anirban, but I have a small comment about your code: On Tue, 24 Mar 2015 13:11:56 +0100 Simon Reinhardt wrote: > Hi Anirban, > > first we have to be clear how you want to sort the lines. > Does 10-1 sort before 1-11 ? > Do you want numeric (use <=>) or alphabetic (

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Simon Reinhardt
Hi Anirban, first we have to be clear how you want to sort the lines. Does 10-1 sort before 1-11 ? Do you want numeric (use <=>) or alphabetic (use cmp) order? > while (my $line = <$RFH>) { > chomp($line); > if ($line =~ m/.*?\-(\d+)\-(\d+).*/) { > $sequence_no = "

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Shaji Kalidasan
Hi Anirban, In case if you print the complete data (the full line) then the following approach may help. Here is one way to do it [code] use strict; use warnings; my %data; open my $fin, '<', 'data.txt' or die "Cannot open file ($!)"; while(<$fin>) { chomp; my($val) = split ',', $_; #s

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Shaji Kalidasan
Hi Anirban, Here is one way to do it [code] use strict; use warnings; my @data; open my $fin, '<', 'data.txt' or die "Cannot open file ($!)"; while(<$fin>) { my($val) = split ',', $_; #split the data using comma my($key, $value) = split '=', $val; #split the values using equal sign (=)

Re: How to sort a file based on numerical values exists in each line

2015-03-24 Thread Anirban Adhikary
Hi List I have completed the code successfully. Please find the code below. #!/usr/bin/perl use strict; use warnings; my $file_name = "RXMOI_TRX_CMD"; open my $RFH, '<', $file_name; my $sequence_no; my %file_content_hash; while (my $line = <$RFH>) { chomp($line); if ($line =~ m/.

How to sort a file based on numerical values exists in each line

2015-03-24 Thread Anirban Adhikary
Hi List I have a file like this. RXMOI:MO=RXOTRX-*473-0*,SC=0,DCP1=178,SIG=SCCONC,DCP2=179&&186,TEI=0; RXMOI:MO=RXOTRX-*473-5*,SC=0,DCP1=223,SIG=SCCONC,DCP2=224&&231,TEI=5; RXMOI:MO=RXOTRX-*473-1*,SC=0,DCP1=187,SIG=SCCONC,DCP2=188&&195,TEI=1; RXMOI:MO=RXOTRX-*473-9*,SC=0,DCP1=259,SIG=SCCONC,DCP2=26

Re: Is DBD installed with DBI?

2015-03-24 Thread Shlomi Fish
Hi Sherman, On Mon, 23 Mar 2015 14:42:54 -0600 Sherman Willden wrote: > I am trying to use perl with mysql. I have a tutorial open which prompted > me to perform the following. > > $ sudo perl -MCPAN -e shell > cpan> install DBI > cpan[2]> install DBD::mysql > > DBI installed. The 'install DBD