Posts
 
Reputation
Joined
Last Seen
Ranked #543
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
100% Quality Score
Upvotes Received
22
Posts with Upvotes
21
Upvoting Members
7
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
12 Commented Posts
~19.7K People Reached
Favorite Forums
Favorite Tags
Member Avatar for k_manimuthu

SAMPLE TABLE 1 =================================== product Division sales % =================================== product1 divsion1 99 product2 divsion1 51 product3 divsion1 50 product4 divsion2 98 product5 divsion2 41 product6 divsion2 40 product7 divsion3 97 product8 divsion3 31 product9 divsion3 30 =================================== Expected output 1 =================================== product2 divsion1 51 product3 divsion1 50 product5 divsion2 41 …

Member Avatar for diafol
0
552
Member Avatar for k_manimuthu

Hi All, I have a sql query i am trying to get the count of how rows it returned. select a.field1, b.field2, c.field2 from table1 as a, table2 as b, table2 as c where a.field1=b.field1 Considered the above query return 9 rows. I want to get count of '9' in …

Member Avatar for k_manimuthu
0
286
Member Avatar for k_manimuthu

Hi, I am trying to get same field name from different tables. And i am using like the below query to get the field name. I am expecting some other queries to get distinct 'function_name' column from 'N' of tables. SELECT function_name FROM base_table UNION SELECT function_name FROM firstcall_table UNION …

Member Avatar for diafol
0
246
Member Avatar for k_manimuthu

Hi All, I am trying to write perl code for extract 'C' user defined function from 'diff' format file. I am using the below keyword to identify the function 'starting pharse' (return value). I am not familar about 'C'. Please suggest some addtion return type which missing from the below …

Member Avatar for rubberman
0
310
Member Avatar for k_manimuthu

Hi all, I am not able to get correct count, if col1 (percentage with respect to product) and col2 have uniq value. Below I post my sample table data and expect output and which i query I tried. Please help me to get in to right direction. CREATE TABLE mysample …

Member Avatar for k_manimuthu
0
234
Member Avatar for k_manimuthu

Hi all, Below is my sample data. I am trying to get the 'product' name only if the percentage count is varying. Could you please suggest your maximum no of 'Mysql' queries to approach this. Thanks in advance. Input: ============================================== percentage product ============================================== 100.00 A 100.00 A 100.00 A 2.18 …

Member Avatar for k_manimuthu
0
297
Member Avatar for k_manimuthu

Hi All, I want to copy the missing 'data' field from 'tb1' to 'tb2' based on the 'id' value. Please suggest the possible queries. mysql> select * from tb1; +------+------+ | id | data | +------+------+ | 1 | A | | 2 | B | | 3 | C …

Member Avatar for k_manimuthu
0
313
Member Avatar for axn

[QUOTE=;][/QUOTE] [CODE] $string="4+21:00"; if ($string=~ m{(\d\+)?(\d\d)(\:)(\d\d)}){ print "\nMatched : $&"; } else { print "\nNot Matched"; } [/CODE]

Member Avatar for axn
0
155
Member Avatar for damorph

[QUOTE=;][/QUOTE] Instead of the line [icode]my $rec = join(',', @fields);[/icode] this adds the double quotes in the data [icode]my $rec = join ( ',', map ("\"$_\"", @fields));[/icode]

Member Avatar for d5e5
0
235
Member Avatar for anunitha

[QUOTE=;][/QUOTE] I assumed your excel file having only one sheet and the data will be two columns. The first column is the name field and second one is mail ids. Try the below code. [CODE] use strict; use Spreadsheet::ParseExcel; my $oExcel = new Spreadsheet::ParseExcel; die "You must provide a filename …

Member Avatar for anunitha
0
91
Member Avatar for boshu

[QUOTE=;][/QUOTE] [CODE] File::Path File::Find File::Copy File::Basename [/CODE] The modules will be help to complete the needs.

Member Avatar for d5e5
0
374
Member Avatar for biojet

[QUOTE=;][/QUOTE] use the 'localtime' function and get the date format. [CODE] $filename='data.txt'; my ($sec,$min,$hour,$mday,$mon,$year)=localtime(); $year+=1900; $mon=sprintf("%02d", $mon+1); $mday=sprintf("%02d", $mday); my $today_file = "$year$mon$mday"."$filename"; print $today_file; [/CODE] Read More... [CODE] perldoc -f localtime [/CODE]

Member Avatar for biojet
0
131
Member Avatar for biojet

The regex engines may reduce the process time, Instead of use the 'substr' inside of the 'for' loop for this case. [CODE] #!/usr/bin/perl use strict; use warnings; my $name='GTGAGCCAGAACTCATCTTCTTTGCTCGAAACCTGGCGCCAAGTTGTTGCCGATCTC'; my $num='50'; while($name=~ m{.{$num}}g) { print "\n\nFirst $num characters\t: $&"; my $reverse = reverse ($&); print "\nReverse $num characters\t: $reverse"; # …

Member Avatar for d5e5
0
201
Member Avatar for blacknred

And another one way by using of expression statement [CODE] #!/usr/bin/perl; use strict; use warnings; while (<DATA>){ s/(\s+)/" [".length($1)." Spaces] "/ge; print ; } __DATA__ I wake up in the morning What time? Always wakeup at 6am.[/CODE]

Member Avatar for k_manimuthu
0
277
Member Avatar for perlnoob

[CODE] use strict; use warnings; open (FIN, "test.xml") or die "Error : $!"; read FIN, my $file, -s FIN; close (FIN); my @table=(); # Get the necessary contents while ($file=~ m{<table((?:(?!<\/?table).)*)</table>}sg) { my $find=quotemeta($&); $file=~ s{$find}{}s; unshift(@table, $&); } # show the extracted conents for (my $i=0; $i<=$#table; $i++) { …

Member Avatar for k_manimuthu
0
138
Member Avatar for bilal.farooq

[QUOTE=;][/QUOTE] 'map' process each element of an array. Here you no need use the map function. You directly add the @A elements to @aFN. [CODE] # map{push(@aFN,$_)}@A; push @aFN, @A; [/CODE]

Member Avatar for bilal.farooq
0
78
Member Avatar for senthilamp4

[iCODE]my $today = "$mon-$mday-$year";[/iCODE], Here $today holds the string values only. But you are using ( [iCODE]if($getdate == $today), if($date_flag == 'true')[/iCODE] ) numerical comparision opertor. When you want to compare two string use the 'eq' operator.

Member Avatar for k_manimuthu
0
234
Member Avatar for boshu

[QUOTE=;][/QUOTE] [CODE] do { unlink if ( !/20110225104849|20110225104833|20110225104848/ ) } for @your_files; [/CODE]

Member Avatar for boshu
0
169
Member Avatar for boshu

[QUOTE=;][/QUOTE] [CODE] ## Code block 1 my $filename = 'test.hrh'; #So you can use diamond operator and inplace editing push @ARGV, $filename; [/CODE] Here $fliename add into defalut array (@ARGV). [CODE] inline_replace.pl test.hrh [/CODE] Here the file name directly assigned to @ARGV. you want to pass the file name in …

Member Avatar for k_manimuthu
0
995
Member Avatar for senthilamp4

[QUOTE=;][/QUOTE] [CODE] $string = '(232,45,3434,535.56)'; $string =~ s/\( # match '(' character ( # start group1 [\d\.,]+ # match digit, dot, comma '1 to many' times ) # end group 1 \) # match ')' character /-$1/x; # retain the group1 # 'x' modifier Allows the white space for # …

Member Avatar for senthilamp4
0
97
Member Avatar for k_manimuthu

I derived Datatable in one class(DataTableEx), then i created one property(TotalRecordCount), then i assigned 5000 to that new property(TotalRecordCount), then i convert this datatable into xml, so it's created.Now i try to convert xml to Datatable, i am not able to get 5000 value to TotalRecordCount Property. so how i …

0
92
Member Avatar for rgpii

[QUOTE=;][/QUOTE] [CODE] my $pattern = "(g$)"; [/CODE] Here '$)' is perl special variable gives the effective group id of the process. So finally $pattern gets '(g0'. It's not a parsed regular expression. I assumed your try to match the letter 'g' at end of the line. So modify the below …

Member Avatar for deepakkrish
0
517
Member Avatar for boshu

[QUOTE=;][/QUOTE] $0 -> Gives the perl file name. @ARGV -> Holds the arguments values. use the above variable in your code and write the log file [CODE] print "\nCommand Line Option used : $0 @ARGV"; [/CODE]

Member Avatar for boshu
0
243
Member Avatar for singhabsk

[QUOTE=;][/QUOTE] [CODE] use strict; use warnings; open (FIN, "time.txt")|| die "Cannot Open the input file : $!"; read FIN, my $file, -s FIN; close (FIN); $file=~s/(\d+)-(\d+)-(\d+)/$1*3600 + $2*60 + $3/ge; open (FOUT, ">Out_time.txt") || die "Cannot create the output file : $!"; print FOUT $file; close (FOUT); [/CODE]

Member Avatar for k_manimuthu
0
106
Member Avatar for boshu

[QUOTE=;][/QUOTE] [CODE] perl -ne 'BEGIN{%email=qw(sam@email.com 1 john@email.com 1 jenifer@email.com 1 );} /Zip_Name:\s*(.*)/; $email{$1}=1; END{print "$_:$email{$_}\n" for sort keys %email;} ' input_file [/CODE] Note : The above code tested at linux.

Member Avatar for boshu
0
175
Member Avatar for boshu

[QUOTE] mismatched tag at line 16, column 2, byte 228 at :/APPS/actperl/site/lib/XML/Parser.pm line 168 [/QUOTE] That is not valid xml format what you post. Goto 16 th line for and change 'ramputan' to 'rambutan'. Here I add the code, that affect the changes in the xml file. ( Thanks d5e5 …

Member Avatar for boshu
0
391
Member Avatar for gutchi

[QUOTE=;][/QUOTE] Please explain your input and the function returned or expected output...

Member Avatar for k_manimuthu
0
220
Member Avatar for realoneomer

[QUOTE=;][/QUOTE] Anther One Way using Regex [CODE] use strict; use warnings; ### Read & store the whole file in $filea open (FILEA, "a.txt") || die "Cannot open the file a.txt : $!"; read FILEA, my $filea, -s FILEA; close (FILEA); ### Read the file B open (FILEB, "b.txt") || die …

Member Avatar for realoneomer
0
1K
Member Avatar for boshu

[QUOTE=;][/QUOTE] Here I added the code for read the .txt format files only. And the remaining things are same. [CODE] use strict; use warnings; my %hash; # Declare your directory my $dir='e:/dani/csv/fruit'; # read the txt file in the $dir opendir(DIR, $dir) || die "Cannot open the $dir : $!"; …

Member Avatar for k_manimuthu
0
203
Member Avatar for fredfletcher

[CODE] open (FIN, "test.csv") || die "Cannot Open the input file"; @file=<FIN>; close (FIN); ## CSV files are separated by comma ## So, split the data by using of 'comma' @get=split/,/, $file[1]; print "\nSecond word from second line : ", $get[1]; [/CODE]

Member Avatar for fredfletcher
0
177