Question: Comparing The Numbers Present In Two Files And Get The Matched [Closed]
0
gravatar for Cynthia
7.9 years ago by
Cynthia190
Cynthia190 wrote:

i need to compare the numbers present in two files.

for example in file1.txt:

human
1 2 3 4 5 6 7 8 9

and in another file2.txt:

human
1 2 3 8 0 7 6

the above two files should be given as input. and the output file will be as:

1 2 3 6 7 8

(i.e. the matching numbers present while comparing the two files) if possible the output must come in another file.

perl homework • 1.9k views
ADD COMMENTlink modified 7.9 years ago by Michael Dondrup45k • written 7.9 years ago by Cynthia190
4

Hi, you are not doing yourself any good with this. Try to solve this problem yourself. It's a good way to learn to program (ltp! ;) ) A good resource for perl coding is also: http://www.perlmonks.org/ After you finished your basic perl course go to Perl Monks page and click: # Seekers of Perl Wisdom

ADD REPLYlink written 7.9 years ago by Michael Dondrup45k
4

Hi Payaliya. People on this forum try to help each other learn to do their analyses by themselves by sharing information, programs or how-to knowledge. The forum is not a place to ask people to program things for you. The prerequisite here is that you try for yourself to learn how to do things. If you take time to learn Perl, Python or R, you will become MUCH more capable of advancing your projects efficiently. Good learning!

ADD REPLYlink written 7.9 years ago by Eric Normandeau10k

Payaliya - the 'edit' question is not for you to try and close questions by modifying the title. That does not close the question, that is a function for moderators.

ADD REPLYlink written 7.9 years ago by Daniel Swan13k
7
gravatar for Michael Dondrup
7.9 years ago by
Bergen, Norway
Michael Dondrup45k wrote:

In a terminal type and read:

perldoc perltoc
perldoc perlintro
perldoc perlfunc

Good luck

More links and books as requested:

http://www.perlmonks.org/

[commecial] i liked the o'reilly books http://oreilly.com/perl/index.html & http://oreilly.com/catalog/9780596002411/ and in paticular the cookbook: http://oreilly.com/catalog/9780596003135/[/commercial] These a bit old but perl 5 didn't change that much over the years.

http://perldoc.perl.org/

And of course this ;) http://www.perlmonks.org/?node_id=237465

ADD COMMENTlink modified 7.9 years ago • written 7.9 years ago by Michael Dondrup45k

+1 Micheal, could you list, as supplementary reading, other perldoc documents you think are worth reading? I have to get done with my ignorance of Perl :)

ADD REPLYlink written 7.9 years ago by Eric Normandeau10k
2
gravatar for Thaman
7.9 years ago by
Thaman3.2k
Finland
Thaman3.2k wrote:

Your computation is strickly related with file handling so better go through the documentation. Also keep in mind, knowing what and how about programming is ability to read documentation and interperate it wisely.

So what you need is

OR

perldoc perlopentut

# You can type them in command line/shell

  • Second task about comparing string can be done through numerous way like split,grep

Moreover, trying yourself first is the best way to deal with the problems.

If you want quick solution then go to http://stackoverflow.com/

ADD COMMENTlink written 7.9 years ago by Thaman3.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1436 users visited in the last hour