Posts
 
Reputation
Joined
Last Seen
Ranked #551
Strength to Increase Rep
+7
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
~20.3K People Reached
Favorite Forums
Favorite Tags

71 Posted Topics

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
556
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
288
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
249
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
316
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
239
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
307
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
317
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
161
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
241
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
95
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
378
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
134
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
203
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
282
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
141
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
81
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
236
Member Avatar for boshu

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

Member Avatar for boshu
0
173
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
1K
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
98
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
94
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
524
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
346
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
111
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
176
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
405
Member Avatar for gutchi

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

Member Avatar for k_manimuthu
0
226
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
205
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
183
Member Avatar for choosenalpha

[QUOTE=;][/QUOTE] I don't show the login process for your code. Include the login credentials, add the "cookie_jar" and include the 'https' keyword in the "protocols_allowed" options to the constructor. That may be helpuful for you.

Member Avatar for k_manimuthu
0
662
Member Avatar for ggs234

[QUOTE=;][/QUOTE] [QUOTE] It should look log file located in specific location (example /mylog) and read "WARNING: Child is hung for request" (Without quotes) message continuously in 50 lines if this exceeds more than 50 lines send an email [/QUOTE] [CODE] while(<LOG>) { # increase the count when the string found …

Member Avatar for k_manimuthu
0
1K
Member Avatar for gutchi

[QUOTE=;][/QUOTE] If you show the code what you have tried, it could be more useful to analyze and give the suggestions on this.

Member Avatar for d5e5
0
251
Member Avatar for anraevlus18

[QUOTE=;][/QUOTE] [CODE] use strict; use warnings; my @file_list= qw(aaa ddd bbb/aaa ccc ddd kkk/ddd hhh); my %exist=(); my @expect; #To remove duplicate elements. my @unique = grep { ! $exist { $_ }++ } @file_list; #To remove elements with same filename. #Please write your code here. # join the array …

Member Avatar for d5e5
0
264
Member Avatar for gutchi

[QUOTE] Is there any way that when I know the value "1527" [/QUOTE] [CODE] use strict; use warnings; my @arrOfArr = ( [ "1023", "1472", "0751651"], [ "1527", "1167", "2496111" ], [ "M167", "1412", "1761683" ], ); my $data = '1527'; my $flag = 0; for my $i ( 0 …

Member Avatar for gutchi
0
219
Member Avatar for ghosh22

[QUOTE=;][/QUOTE] [QUOTE] But my perl script is not taking the whole file. [/QUOTE] [CODE] undef $/; # input record Separator open (FILEHANDLE, "$input_file") || die "Cannot Open the $input_file : $!"; my $file_content = <FILEHANDLE>; close (FILEHANDLE); print $file_content; [/CODE] or [CODE] open (FILEHANDLE, "$input_file") || die "Cannot Open the …

Member Avatar for ghosh22
0
123
Member Avatar for terabyte

[CODE] push @matches, $1 while ($source=~ m{(PATTERN)}g); [/CODE] Is this you want ?

Member Avatar for mitchems
0
169
Member Avatar for ghosh22

[QUOTE=;][/QUOTE] Read the command line arguments and pass your file name as below. [CODE] perl filename.pl example.txt [/CODE] $ARGV[0] - consider as the input file.

Member Avatar for ghosh22
0
158
Member Avatar for ghosh22

[QUOTE] But I want it Length is 12 [/QUOTE] So you must add the length value recursively in $length. Below i slightly change you code, try this.... [CODE] #!usr/bin/perl -w print "Print your file name with location\n"; $dnafile=<STDIN>; chomp $dnafile; open (DNA, $dnafile) || die "Cannot open the file : …

Member Avatar for ghosh22
0
316
Member Avatar for Makailah

[QUOTE=;][/QUOTE] [CODE] use strict; use warnings; ### Declare you input file location my $f_path="e:/dani/test1/hash.txt"; ### Declare your Subroutine and the file as a argument my %hash = get_hash ("$f_path"); ### print the input file keys and values print "\n$_ : $hash{$_}" for (keys %hash); sub get_hash { my ($f_name)=@_; my …

Member Avatar for yuvanbala
0
123
Member Avatar for Makailah

[QUOTE=;][/QUOTE] Hi Makailah, For the input, your program is correct. I assume you forgot to print the result. Place the below codes at the end of the program. that shows your result of the program. [CODE] print "\nColumn 1 Average Value = ", $col1; print "\nColumn 2 Average Value = …

Member Avatar for yuvanbala
0
1K
Member Avatar for nonshatter

[CODE] use strict; use warnings; print "Enter Defect Number: "; my $text1 = <STDIN>; chomp($text1); ### Syntax : ( Condition ) ? ( True Statement ) : ( False Statement); print "\n", ($text1=~ m{^([a-z]{3}\-\d{3})$}i)? # Condition 1 "The string is correct\n" : # True Statment 1 (($text1=~ m{^(([a-z]{3})(\d{3}))$}i)? # Condition …

Member Avatar for k_manimuthu
0
197
Member Avatar for Anthony Cameron

[URL="http://www.cs.cmu.edu/afs/cs/usr/rgs/mosaic/pl-exp-arr.html"]http://www.cs.cmu.edu/afs/cs/usr/rgs/mosaic/pl-exp-arr.html [/URL] [URL="http://docstore.mik.ua/orelly/perl3/prog/ch09_01.htm"]http://docstore.mik.ua/orelly/perl3/prog/ch09_01.htm [/URL] Read the above links and try the sample program [CODE] print "Enter a number:\n"; chomp ($number1=<>); print "Enter another number:\n"; chomp ($number2=<>); @array = qw(Yellow Green Brown Pink Black); ### Validate the input selection unless ( $number1+ $number2 <= scalar @array ) { print "\n\t$number1, $number2 …

Member Avatar for Anthony Cameron
0
255
Member Avatar for koduruabhinav

which one you are using? 1. mkdir or 2. mkpath mkdir : Creates directory for first level only. mkpath : Creates directory for Nth level if you are using mkpath you must declare the 'File:: Path' module. For your example you tried create more than one level. So must use …

Member Avatar for koduruabhinav
0
171
Member Avatar for ajay_p5

ajaj_p5, I slightly change your code in the XPath and data process lines. [CODE] use strict; use warnings; use XML::XPath; my $file = 'Aj.xml'; my $xp = XML::XPath->new(filename=>$file); print "\nYear\tNo. of different authors publishing in a single year"; foreach my $year ( 1913, 1917) { ### Declare the hash as …

Member Avatar for richieking
0
327
Member Avatar for k_manimuthu

I have a table like below format. [CODE] CREATE TABLE Customer ( number VARCHAR(40) NOT NULL, --col 1 name VARCHAR(100) NOT NULL, --col 2 ssn VARCHAR(50) NOT NULL, --col 3 age INTEGER NOT NULL, --col 4 ) [/CODE] I want to add a new column in the table. If I …

Member Avatar for pritaeas
0
158
Member Avatar for ryan461

You may declare the %score as a global variable, then you able to access the variable across the program for the updated values Try below codes in your declaration part. [CODE] ### declare the global variable ... our %score [/CODE] Otherwise [CODE] ## the declared variable considered as the global …

Member Avatar for ryan461
0
289
Member Avatar for ajay_p5

[CODE] ### Open the files and get the contents open (FILE1, "file1.txt"); read FILE1, $file1, -s FILE1; close (FILE1); open (FILE2, "file2.txt"); read FILE2, $file2, -s FILE2; close (FILE2); ### process file1 : Store the data in hash format $id{$1}=$2 while ($file1=~ m{([^\s]+)\s+(\d+)}g); ### process file2 : if the 'id' …

Member Avatar for k_manimuthu
0
319
Member Avatar for ajay_p5

[CODE] use strict; use warnings; while (<DATA>) { my $line = $_; ## Split the string use by space my @array = split / /, $line; ## Process the array ( 2 element to end of the array element ) ## Replace default variable dot character into space with globally …

Member Avatar for ajay_p5
0
91
Member Avatar for anraevlus18

While you want to search the meta characters, you will use the [URL="http://perldoc.perl.org/functions/quotemeta.html"]quotemeta[/URL] function.

Member Avatar for anraevlus18
0
1K

The End.