Compare two files & output in third file in Perl scripting file 1 = 1,2,3,4 filw 2 = 1,3,2.4 output = 2,3 putput =3,2 basically want compare 2 files and store diff in other output fil

Member Avatar
Member Avatar
+0 forum 1

I am trying to process the data in a single file . i have to read the file and create a hash structure,get the value of fruitname append it to fruitCount and fruitValue and delete the line fruitName and write the entire output after the change is done.Given below is the content of file. # this is a new file { date 14/07/2016 time 11:15 end 11:20 total 30 No "FRUITS" Fruit_class { Name "fruit 1" fruitName "apple.fru" fruitId "0" fruitCount 5 fruitValue 6 } { Name "fruit 2" fruitName "orange.fru" fruitId "1" fruitCount 10 fruitValue 20 } } I …

Member Avatar
Member Avatar
+0 forum 1

Anyone have a shell script to remove controlM character from all the files in a directory

Member Avatar
Member Avatar
+0 forum 14

test for check more 5 items

Member Avatar
Member Avatar
+0 forum 4

Hello. I've been programming in Perl for a while and wanted to add something to my code in order to pull data from a text file. I am using regular expressions to get the data I need with the exception that once in a while, the data I need will be preceeded by an asterisk and will be skipped when my code is ran. Below is a section of code I think needs to be updated. I know I have to escape the asterisk, but not sure how given the context of my regular expression. I belive my second 'if' …

Member Avatar
Member Avatar
+0 forum 1

How to take the maximum digits file linked with the folder using perl? my $location = $output_dir; print $location; open LOGFILE, $location; my $first_line = 1; #print $first_line; my $max_id; while (<LOGFILE>) { if (/rev_(\d)+/) { if ($first_line) { $first_line = 0; $max_id = $1; } else { $max_id = $1 if ($1 > $max_id); print $max_id; } } } close LOGFILE; Obtained output: |-- USB_FS | |-- Database | | |-- rev1 | | | |-- slater_ams_USB_FS_Database_rev1_.config | | | `-- slater_ams_USB_FS_Database_rev1_.html | | |-- rev2 | | | |-- slater_ams_USB_FS_Database_rev2_.config | | | `-- slater_ams_USB_FS_Database_rev2_.html | | |-- …

Member Avatar
Member Avatar
+0 forum 2

sub runDir($$); sub runDir($$) { my $prefix = shift @_; my $dir = shift @_; opendir(DIR, $dir) or die $!; my @entries = readdir(DIR); close(DIR); foreach my $file (@entries) { next if ($file =~ /^\.+$/); if ( -d $dir . '/' . $file) { runDir($prefix . $file .'_', $dir . '/' . $file); } elsif ( ( -f $dir . '/' . $file ) && ( $file =~ /\.config$/ ) && ($file !~ /^$prefix/)) { my $suffix = $file; $suffix=~s{\A[^.]*}{}xms; rename $dir . '/' . $file, $dir . '/' . $prefix . $suffix ; } } } runDir('',$output_dir);</pre> obtained output: …

Member Avatar
+0 forum 0

All, I am trying to a call a fly program which generates dynamic images on a webpage and I'm geting this error -> malformed header from script. Bad header=/usr/home/gump/bin/fly: The main code is as such and I've tried various varaitions of the Content-Type headers to no avail - the simple-lib.pl code which is referred to - I've included as well for reference: #!/usr/bin/perl5 require 'simple-lib.pl'; &flyprog; $output = `$flyprog -i $flytemp`; print "\n\n"; print "Content-Type: text/html\n\n"; print "Content-Type: image/gif\n\n"; print "$output"; #!/usr/bin/perl5 sub flyprog { $flyprog = "/usr/home/gump/bin/fly"; } 1;

Member Avatar
Member Avatar
+0 forum 3

Hi PerlGurus, I am really new to perl and liitle handson with the concepts here. I am trying to learn the hash & Array concepts and come up a self exercise to do practice. *Got two files * # inFile01 as below: # CLAYCOUNTY;Wood;statecode=FL CLAYCOUNTY;Wood;statecode=FL SUWANNEECOUNTY;Wood;statecode=FL SUWANNEECOUNTY;Wood;statecode=TX SUWANNEECOUNTY;Wood;statecode=TX SUWANNEECOUNTY;Wood;statecode=TX NASSAUCOUNTY;Wood;statecode=UT # infile02 as below: # 119736;Residential;CLAYCOUNTY 448094;Residential;CLAYCOUNTY 206893;Residential;CLAYCOUNTY 333743;Residential;CLAYCOUNTY 172534;Residential;CLAYCOUNTY 785275;Residential;CLAYCOUNTY 995932;Residential;CLAYCOUNTY 223488;Residential;CLAYCOUNTY 433512;Residential;CLAYCOUNTY 640802;Residential;SUWANNEECOUNTY 403866;Residential;SUWANNEECOUNTY 828788;Residential;SUWANNEECOUNTY 751490;Residential;SUWANNEECOUNTY 972562;Residential;SUWANNEECOUNTY 367541;Residential;SUWANNEECOUNTY 481360;Residential;SUWANNEECOUNTY 920232;Residential;NASSAUCOUNTY 727659;Residential;NASSAUCOUNTY 471817;Residential;NASSAUCOUNTY 983043;Residential;NASSAUCOUNTY 578286;Residential;NASSAUCOUNTY Step 1: Parse file inFile01 with search key "Wood" and store the file columns into hash. I want to use 2nd and 3rd column …

Member Avatar
Member Avatar
+0 forum 6

sir good day. i have question regarding PLC in DOL i can start the motor but i cannot stop it using remote in cpu

Member Avatar
+0 forum 0

Hi , I am looking for some directions with this and posted the same question in one more forum. am trying to get the word type as an output from an input file (input.txt) which looks like this, Input file John N N loved V Mary N N . S He N was V eating V in P P a A A restaurant N . S The A A cats N N killed V the A A rats N N . S I N am V playing V . S The input file has three columns. The first column are …

Member Avatar
Member Avatar
+0 forum 1

Hi, I have two text files. The first one has a list of words , like the following : File 1.txt Laura Samuel Gerry Peter Maggie The second one has paragraphs on it. For e.g. : File2.txt Laura is about to meet Gerry and is planning to take Peter along All is want the program to do is , look for common words and print "Match" beside the matching words in File2.txt or to a third output file. So the desired output should look like this. Laura | MATCH is about to meet Gerry | MATCH and is planning to …

Member Avatar
Member Avatar
+0 forum 2

Hello, Can you please help me with the following scenario in Perl scripting? I want to compare two text files and save output of this comparision in third file with flag PP. So basically, the word common in both the text files should be printed with a flag |PP on the second text file. File1.txt - abc efg xyz File2.txt abc efh pqr Expected output is - File2.txt abc |PP efg xyz efh pqr

Member Avatar
Member Avatar
+0 forum 7

Is there a good utility to fix .pst files?

Member Avatar
Member Avatar
+1 forum 1

Hello, I'm new to perl and I'm trying to compile a perl code that I downloaded from web. I'm getting the below error. -------------------------------------------------------------------------------------------------------------------------- Can't locate docs/perlmod/DoxyDocs.pm in @INC (you may need to install the docs::perlmod::DoxyDocs module) --------------------------------------------------------------------------------------------------------------------------- Where do I download DoxyDocs module from for linux? Please help me out.

Member Avatar
Member Avatar
+0 forum 4

HI I have a master spreadsheet with 60 columns, which is updated with new data from an updates file. The new data can be whole new lines or just cells. luckily i came across your site and found an excellent script which does exactly what i want, the only problem i have, is in my case i reference column 'B' in my master file to see if any new data fields need updating, where as in the script on your site the reference ($username) is in column A. the problem i have is when i output the new file i …

Member Avatar
Member Avatar
+0 forum 5

I have written a code to automate my webpage to do a search and download a report. Till selection of the report everything works fine. But download click is not working after clicking checkbox. It works well if i keep the download click bust before checkbox select. But I need to select the reports to click download. <form action="xxx.net:1234/xxx/xxx/abc.do?starttrail=true&advancedSearch=true" onsubmit="javascript:deleteReport(this);"> <input type="hidden" name="formAction" id="formAction"/> <table id="reportLog" class="content" cellspacing="0" cellpadding="0"> <tr> <th class="actionHeader" colspan="5"> <div class="leftButtons"> <input type="button" id="deleteButton" name="delete" value='Delete' height="5" /> <input type="button" id="downloadButton" name="download" value='Download' height="5" /> </div> </th> </tr> <tr> <th class="column checkbox"><input type="checkbox" name="selectAll" onClick='javascript:checksOnlyActive(this.checked, this.form, …

Member Avatar
+0 forum 0

I have two files large files: 1) file1.txt as below: ( more than 20,000 records ) 5020120475 |13ZJ38000813 |20141204|R 5020127431 |13ZJ38001569 |20141201|R 5020127689 |12ZJ44000606 |20141203|R 5020127728 |13ZJ38001356 |20141203|R 5020127956 |13ZJ62002544 |20141205|R 5020127972 |13ZJ49000082 |20141205|R 5020128325 |13ZJ57000785 |20141210|R 5020128706 |13ZJ38002805 |20141211|R 5020129084 |10XJ70107764 |20141217|R 5020129102 |12ZJ54000041 |20141217|R and 2) other file as file2.txt as below: ( more than 2,00,000 records ) 09Y903010552 12ZJ54000041 11XJ62118385 08Y909018946 09Y902011954 11XJ57120346 10XJ70107764 11XJ40165329 09XJ42008336 08Y912021435 11XJ51040272 07Y910027235 and I need expexted output as below: 5020129084 |10XJ70107764 |20141217|R 5020129102 |12ZJ54000041 |20141217|R NOTE: it will compare first file of 2nd column and second file of ist column …

Member Avatar
Member Avatar
+0 forum 2

Hi, I'm new to perl and I'm stuck at regular expression on which to get the data of deck, super and trial from an array. I have an input file as the following : `deck { @STATE = "this is low"; @ACCESS = "RW"; } [6:0]; super { @STATE = "this is target"; @ACCESS = "RW"; } [3:3]; trial { @STATE = "this is power"; @ACCESS = "RW"; } [5:4];` Here is my code : my $file1 = "in.txt"; my @array = ("deck", "super", "trial"); open (INPUT, "<", $file1) || die "\nError: File Read error\n"; my @input=<INPUT>; close INPUT; foreach …

Member Avatar
+0 forum 0

0 down vote favorite I'm using Wireshark packet analyzer & when I filter for all "Websocket" packets I see what I am sending /receiving to the host. When I check individual packets mine always show as [MASKED], but you can 'Umask Payload' which shows the data in clear text that looks like this: <IC sid="52ccc752-6080-4668-8f55-662020d83979" msqid="120l93l9l114l30l104"/> However, if I 'Follow TCP stream & look at that same packet, the data shows up as encoded in some way like this: ....K#....../...y@..|...}...f...s...~...}...{G..r...kN.."G..z...r...'...'...z...d. The problem is all Websocket packets I receive from the host come as encoded, it is NOT SSL & I …

Member Avatar
Member Avatar
-1 forum 1

is it possible to update a portion of our website via email (if a blank email is sent, the dhtml window will be hidden) if an email with text is sent, it will show the box, saying NEWS and a border, with the text sent via email inside... when you write again, it would erase the first and post the new text... email a blank email, text box goes away compeletly... i need a master! teach me! thank you pj

Member Avatar
Member Avatar
-1 forum 11

My program is supposed to decide whether a number is an integer or not. I've tried: if ($variable % 1 = 0) and: if ($variable % 1.0 = 0) I know that it can be done with regular expressions, but I'm only on day three of Sams Perl in 21 Days and I haven't learned them yet. Is there another way?

Member Avatar
Member Avatar
+0 forum 3

I am using XML:twig to extract some attributes from an XML file using Perl; Here is my code: use XML::Twig; my $file = $ARGV[0]; $file =~ /(.+)\.xml/; my $outfile = $1.".snp" ; open my $out,'>',$outfile or die "Could not open file '$outfile' $!"; my $twig = XML::Twig->new ( twig_handlers => { 'Rs/MergeHistory' => \&MergeHistory, } ); $twig -> parsefile( "$file"); sub MergeHistory { my ($twig, $elt) = @_; print $out "\t"; print $out "rs"; print $out $elt->att('rsId'), ","; print $out "b"; print $out $elt->att('buildId'), ","; } This print the following results: rs56546490,b130, rs386588736,b142 rs56546490,b130, rs386588736,b142 What I want is to …

Member Avatar
Member Avatar
+0 forum 2

Hi guys I have two files as listed below. I want to compare first column from second file with the first column from first file, if exists, give it the same value of second column from the first file as second column for the second file. If not, increase the biggest value of second column of first file by one and add it as a value for second file. Any tips to start working on. Thanks in advance File 1: C1 Value 123 5 121 4 122 6 212 7 File 2: C1 123 111 122 124 --------- The results …

Member Avatar
Member Avatar
+0 forum 3

I want an idea on how to make online chatting network in perl, just like a messenger where if there's an online people you can chat him/her. I know how to create a chat network in perl but everyone can chat in an single network like a public chat room, But what i was trying to say is you can only chat people who are online and only both of you can see your messages. I have a limited idea on how to make this things work do i need to create a server for each client entered my program? …

Member Avatar
Member Avatar
+0 forum 1

I am new to perl. In a string How do I replace a backward slash with a forward slash? when I call the following perl api $FindBin::Bin; I get the path as follows $myPath = c:/perl/test I would like to covert this to c:\perl\test I did try the following and get errors #$myPath=~ tr/\//\/c;

Member Avatar
Member Avatar
+0 forum 14

HI, With Win32::GUI - need to create a window with scroll bar , within a main window. This second window (child of a main window) will hold different buttons/checkboxes ,etc , and will have a scroll bar . Did not find so far any package in win32::GUI that will enable me to achieve the above. Help appreciated. thanks Code: my $main = Win32::GUI::Window->new( -name => 'Main',-width => 860,-height => 950, ,-pos => [700,10]); my $frame5 = $main->AddGroupbox(-width => 490,-height => 675,-vscroll =>1,-pos => [ 2, 88 ]); ..now fill this new Groupbox with different controls that exceed the bax height. …

Member Avatar
Member Avatar
+0 forum 1

Hi there, yesterday I tried a very basic cgi program, which comes with xampp 1.7.1 in cgi-bin directory. but my browser said: "You don't have permission to access the requested object. It is either read-protected or not readable by the server." The perl code is : [CODE] #!"C:\xampp\perl\bin\perl.exe" print "Content-type: text/html\n\n"; print '<html>'; print '<head>'; print '<meta name="author" content="Kay Vogelgesang">'; print '<link href="/xampp/xampp.css" rel="stylesheet" type="text/css">'; print '</head>'; print "<body>&nbsp;<p><h1>GCI with MiniPerl</h1>"; print "CGI with MiniPerl is ready ...</body></html>"; [/CODE] The file name is "perltest.cgi" and I executed it by typing "http://localhost/C:/xampp/cgi-bin/perltest.cgi" in my browser. please help! regards

Member Avatar
Member Avatar
+0 forum 4

Dear All, I want to know whether there is any perl script availabe to compare more than two files and print out the matching rows, for example if i have following files, file_1 TPT 0.0520852296 RP11 0.1062639955 AC01 1.4112745088 AC00 0.4992644913 file_2 LINC 0.1648703511 AC00 0.1632039268 CTD 4.3654577641 RP1 0.1357422856 AC01 1.456789 AC00 0.56789 file_3 RP1 0.0034001871 Z8385 0.0183523803 LINC 0.0099523132 AC01 1.4112745088 AC00 0.356788899 ....... like this have many files but all files with just two columns and I want my out put as, AC01 1.4112745088 1.4112745088 1.456789 AC00 0.4992644913 0.356788899 0.56789 where the matching rows in three of …

Member Avatar
Member Avatar
+0 forum 5

Dear All, I have two files where I need to map file_1 to file_2 based on the similarity of the 1st column from file_1 to 8th column to file_2 and print the similar rows with annotaions for that. I am able to achieve that with the following perl script. But the problem is my perl script is not able to differntiate the dot(.) in the word which I used to map the columns. my file_1 and file_2 looks like following, file_1: CUFF.2 chr1:14362-29806 24.2763 22.1124 26.4401 OK CUFF.23 chr1:89294-173862 4.95251 3.44948 6.45555 OK and file_2: chr1 Cufflinks transcript 11869 14409 …

Member Avatar
Member Avatar
+0 forum 4

The End.