Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Perl script to read

Expand Messages
  • gopi chand
    Thanks for the reply Jeff. I don t want to print all the letters in the first column which have an yes in second column,I only want to print the ones in
    Message 1 of 15 , Jan 25, 2010
    • 0 Attachment
      Thanks for the reply Jeff.

      I don't want to print all the letters in the first column which have an "yes" in second column,I only want to print the ones in sample.txt file,how are we taking care of this condition?


      --- On Mon, 1/25/10, Jeff Soules <soules@...> wrote:

      From: Jeff Soules <soules@...>
      Subject: Re: [PBML] Perl script to read
      To: "perl-beginner@yahoogroups.com" <perl-beginner@yahoogroups.com>
      Date: Monday, January 25, 2010, 6:01 PM







       









      I would begin by saving the excel file in a plain text format. Tab-

      delimited would likely work well, if this is a complete description of

      the doc (if there aren't any tabs or anything).



      Then I would read the file in line by line and use split to get the

      two columns (these are 2 columns right?) into separate fields. Use

      regex or string comparison (eq) to see if the second field is yes, and

      if it is, print the first field.



      There are no doubt more robust solutions, but something along these

      lines ought to get you started if it's just a quickie.



      Good luck.



      On Jan 25, 2010, at 8:39 PM, "GoPi" <gopichand84@ yahoo.com> wrote:



      > Hi friends,

      >

      > Hopeeveryone is doing good.

      >

      > 1.I have an excel sheet in 2003 with columns like below

      >

      > A Yes

      > B No

      > C Yes

      > D Yes

      >

      > 2.I have a file "sample.txt" which contains all the leters like below

      >

      > A

      > B

      > C

      > D

      >

      > Now,I my objective is to write a perl script to output only the

      > letters that are listed as "Yes" in my excel sheet.Can some pls help

      > to give me a starting point?

      >

      > Thanks

      >

      >



      [Non-text portions of this message have been removed]

























      [Non-text portions of this message have been removed]
    • gopi chand
      How do I install it? ... From: merlyn@stonehenge.com Subject: Re: [PBML] Perl script to read To: gopi chand
      Message 2 of 15 , Jan 25, 2010
      • 0 Attachment
        How do I install it?




        --- On Mon, 1/25/10, merlyn@... <merlyn@...> wrote:

        From: merlyn@... <merlyn@...>
        Subject: Re: [PBML] Perl script to read
        To: "gopi chand" <gopichand84@...>
        Cc: perl-beginner@yahoogroups.com
        Date: Monday, January 25, 2010, 6:22 PM







         









        >>>>> "gopi" == gopi chand <gopichand84@ yahoo.com> writes:



        gopi> What am I missing?



        Looks like you're missing Spreadsheet: :Read.



        --

        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095

        <merlyn@stonehenge. com> <URL:http://www.stonehen ge.com/merlyn/>

        Smalltalk/Perl/ Unix consulting, Technical writing, Comedy, etc. etc.

        See http://methodsandme ssages.vox. com/ for Smalltalk and Seaside discussion























        [Non-text portions of this message have been removed]
      • merlyn@stonehenge.com
        ... Jeff I would begin by saving the excel file in a plain text format. No, Perl can read native Excel sheets just fine, thanks to the nice libraries in the
        Message 3 of 15 , Jan 25, 2010
        • 0 Attachment
          >>>>> "Jeff" == Jeff Soules <soules@...> writes:

          Jeff> I would begin by saving the excel file in a plain text format.

          No, Perl can read native Excel sheets just fine, thanks to the nice libraries
          in the CPAN.

          --
          Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
          <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
          Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
          See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
        • merlyn@stonehenge.com
          ... gopi How do I install it? perldoc perlmodinstall -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
          Message 4 of 15 , Jan 25, 2010
          • 0 Attachment
            >>>>> "gopi" == gopi chand <gopichand84@...> writes:

            gopi> How do I install it?

            "perldoc perlmodinstall"

            --
            Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
            <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
            Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
            See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
          • gopi chand
            I am getting the same error message even after running perldoc perlmodinstall Will the above command install the required mods are do I have read something and
            Message 5 of 15 , Jan 25, 2010
            • 0 Attachment
              I am getting the same error message even after running perldoc perlmodinstall

              Will the above command install the required mods are do I have read something and install some other commands?Pls let me know



              --- On Mon, 1/25/10, merlyn@... <merlyn@...> wrote:

              From: merlyn@... <merlyn@...>
              Subject: Re: [PBML] Perl script to read
              To: "gopi chand" <gopichand84@...>
              Cc: perl-beginner@yahoogroups.com
              Date: Monday, January 25, 2010, 6:28 PM







               









              >>>>> "gopi" == gopi chand <gopichand84@ yahoo.com> writes:



              gopi> How do I install it?



              "perldoc perlmodinstall"



              --

              Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095

              <merlyn@stonehenge. com> <URL:http://www.stonehen ge.com/merlyn/>

              Smalltalk/Perl/ Unix consulting, Technical writing, Comedy, etc. etc.

              See http://methodsandme ssages.vox. com/ for Smalltalk and Seaside discussion























              [Non-text portions of this message have been removed]
            • Francis Kayiwa
              ... If you ran perldoc perlmodinstall it should help you find out if a) the module is installed on your system.. ... PREAMBLE First, are you sure that the
              Message 6 of 15 , Jan 25, 2010
              • 0 Attachment
                On Mon, Jan 25, 2010 at 9:14 PM, gopi chand <gopichand84@...> wrote:
                >
                >
                >
                > I am getting the same error message even after running perldoc perlmodinstall
                >
                > Will the above command install the required mods are do I have read something and install some other commands?Pls let me know

                If you ran perldoc perlmodinstall

                it should help you find out if

                a) the module is installed on your system..

                ...
                PREAMBLE
                First, are you sure that the module isn't already on your
                system? Try "perl -MFoo -e 1". (Replace "Foo" with the
                name of the module; for instance, "perl -MCGI::Carp -e 1".
                ...

                Substitute CGI::Carp with the module we are discussing.

                If it isn't you should read further down on the steps needed to install it.

                regards,
                ./fxk

                --
                =====
                Past hissy-fits are not a predictor of future hissy-fits --Nick Holland
              • merlyn@stonehenge.com
                ... gopi I am getting the same error message even after running perldoc perlmodinstall gopi Will the above command install the required mods are do I have
                Message 7 of 15 , Jan 25, 2010
                • 0 Attachment
                  >>>>> "gopi" == gopi chand <gopichand84@...> writes:

                  gopi> I am getting the same error message even after running perldoc perlmodinstall

                  gopi> Will the above command install the required mods are do I have read something and install some other commands?Pls let me know

                  "perldoc perlmodinstall" is instructions to you about how to obtain
                  and install modules. Please read.

                  --
                  Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
                  <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
                  Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
                  See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
                • Jeff Soules
                  ... Ahh. I was wondering how the second file figured in this whole business. Do the order of the letters in the second file matter? i.e. is your goal: if the
                  Message 8 of 15 , Jan 25, 2010
                  • 0 Attachment
                    > I don't want to print all the letters in the first column which have an "yes" in second column,I only want to print the ones in sample.txt file,how are we taking care of this condition?

                    Ahh. I was wondering how the second file figured in this whole business.
                    Do the order of the letters in the second file matter? i.e. is your goal:

                    if the letter is next to "yes" in your excel file AND
                    the letter appears somewhere in the second file, THEN
                    output the letter?

                    If so, I would read the letters in the second file and load them into
                    a hash (%lettersHash, perhaps.)
                    Then go back and read the excel file through one of the methods
                    discussed previously (the method you choose shouldn't affect your
                    results for the problem as you've described it, There's More Than One
                    Way To Do It, etc).
                    For each row/record of the excel file, if the value of the second
                    column is "yes," check if the value in the first column is in
                    %lettersHash. If it is, output the letter. If not, read the next
                    record.

                    On the other hand, if you want to do something more complicated (like
                    if the order of the second file matters -- say you only output the
                    letter if row N of the excel file says "A Yes" and row N of the second
                    file says "A"), then please describe your problem in more detail.


                    good luck,
                    jeff

                    On Mon, Jan 25, 2010 at 9:22 PM, gopi chand <gopichand84@...> wrote:
                    >
                    >
                    > Thanks for the reply Jeff.
                    >
                    > I don't want to print all the letters in the first column which have an "yes" in second column,I only want to print the ones in sample.txt file,how are we taking care of this condition?
                    >
                    >
                    > --- On Mon, 1/25/10, Jeff Soules <soules@...> wrote:
                    >
                    > From: Jeff Soules <soules@...>
                    > Subject: Re: [PBML] Perl script to read
                    > To: "perl-beginner@yahoogroups.com" <perl-beginner@yahoogroups.com>
                    > Date: Monday, January 25, 2010, 6:01 PM
                    >
                    >
                    >
                    > I would begin by saving the excel file in a plain text format. Tab-
                    > delimited would likely work well, if this is a complete description of
                    > the doc (if there aren't any tabs or anything).
                    >
                    > Then I would read the file in line by line and use split to get the
                    > two columns (these are 2 columns right?) into separate fields. Use
                    > regex or string comparison (eq) to see if the second field is yes, and
                    > if it is, print the first field.
                    >
                    > There are no doubt more robust solutions, but something along these
                    > lines ought to get you started if it's just a quickie.
                    >
                    > Good luck.
                    >
                    > On Jan 25, 2010, at 8:39 PM, "GoPi" <gopichand84@ yahoo.com> wrote:
                    >
                    > > Hi friends,
                    > >
                    > > Hopeeveryone is doing good.
                    > >
                    > > 1.I have an excel sheet in 2003 with columns like below
                    > >
                    > > A Yes
                    > > B No
                    > > C Yes
                    > > D Yes
                    > >
                    > > 2.I have a file "sample.txt" which contains all the leters like below
                    > >
                    > > A
                    > > B
                    > > C
                    > > D
                    > >
                    > > Now,I my objective is to write a perl script to output only the
                    > > letters that are listed as "Yes" in my excel sheet.Can some pls help
                    > > to give me a starting point?
                    > >
                    > > Thanks
                  • Shlomi Fish
                    ... Hi Gopi! 1. Please read: http://perl-begin.org/topics/cpan/ and be enlightened. 2. perl-5.8.5 is really old, you really should upgrade to perl-5.8.9 or
                    Message 9 of 15 , Jan 26, 2010
                    • 0 Attachment
                      On Tuesday 26 Jan 2010 04:19:56 gopi chand wrote:
                      > Hi Merlyn ,
                      >
                      > Thanks for the reply.I havent' read that documentation but I started of
                      > with a sample pl script I got over the internet but I am getting the
                      > following message while running the script What am I missing?
                      >
                      > Can't locate Spreadsheet/Read.pm in @INC (@INC contains: C \Program
                      > Files\ActiveState Perl Dev Kit 6.0\lib\
                      > /usr/lib/perl5/5.8.5/cygwin-thread-multi-64int /usr/lib/perl5/5.8.5
                      > /usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int
                      > /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl
                      > /usr/lib/perl5/vendor_perl/5.8.5/cygwin-thread-multi-64int
                      > /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl .) at
                      > sample.pl line 4.

                      Hi Gopi!

                      1. Please read: http://perl-begin.org/topics/cpan/ and be enlightened.

                      2. perl-5.8.5 is really old, you really should upgrade to perl-5.8.9 or
                      perl-5.10.1.

                      Regards,

                      Shlomi Fish

                      >
                      >
                      > --- On Mon, 1/25/10, merlyn@... <merlyn@...> wrote:
                      >
                      > From: merlyn@... <merlyn@...>
                      > Subject: Re: [PBML] Perl script to read
                      > To: "GoPi" <gopichand84@...>
                      > Cc: perl-beginner@yahoogroups.com
                      > Date: Monday, January 25, 2010, 5:56 PM
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      > >>>>> "GoPi" == GoPi <gopichand84@ yahoo.com> writes:
                      > GoPi> 1.I have an excel sheet in 2003 with columns like below
                      >
                      >
                      >
                      > GoPi> A Yes
                      >
                      > GoPi> B No
                      >
                      > GoPi> C Yes
                      >
                      > GoPi> D Yes
                      >
                      >
                      >
                      > GoPi> 2.I have a file "sample.txt" which contains all the leters like below
                      >
                      >
                      >
                      > GoPi> A
                      >
                      > GoPi> B
                      >
                      > GoPi> C
                      >
                      > GoPi> D
                      >
                      >
                      >
                      > GoPi> Now,I my objective is to write a perl script to output only the
                      > letters
                      >
                      > GoPi> that are listed as "Yes" in my excel sheet.Can some pls help to give
                      > me
                      >
                      > GoPi> a starting point?
                      >
                      >
                      >
                      > How much of the documentation for Spreadsheet: :ParseExcel have you read
                      > and
                      >
                      > understood? Do you have specific questions about that module?

                      --
                      -----------------------------------------------------------------
                      Shlomi Fish http://www.shlomifish.org/
                      Freecell Solver - http://fc-solve.berlios.de/

                      Deletionists delete Wikipedia articles that they consider lame.
                      Chuck Norris deletes deletionists whom he considers lame.

                      Please reply to list if it's a mailing list post - http://shlom.in/reply .
                    • gopi chand
                      Do the order of the letters in the second file matter? ... if the letter is next to yes in your excel file AND the letter appears somewhere in the second
                      Message 10 of 15 , Jan 26, 2010
                      • 0 Attachment
                        Do the order of the letters in the second file matter?
                        >>  Yes it matters

                        if the letter is next to "yes" in your excel file AND

                        the letter appears somewhere in the second file, THEN

                        output the letter?
                        >>>> Can you pls tell me how do I do that?


                        --- On Mon, 1/25/10, Jeff Soules <soules@...> wrote:

                        From: Jeff Soules <soules@...>
                        Subject: Re: [PBML] Perl script to read
                        To: "gopi chand" <gopichand84@...>
                        Cc: perl-beginner@yahoogroups.com
                        Date: Monday, January 25, 2010, 8:36 PM







                         









                        > I don't want to print all the letters in the first column which have an "yes" in second column,I only want to print the ones in sample.txt file,how are we taking care of this condition?



                        Ahh. I was wondering how the second file figured in this whole business.

                        Do the order of the letters in the second file matter? i.e. is your goal:



                        if the letter is next to "yes" in your excel file AND

                        the letter appears somewhere in the second file, THEN

                        output the letter?



                        If so, I would read the letters in the second file and load them into

                        a hash (%lettersHash, perhaps.)

                        Then go back and read the excel file through one of the methods

                        discussed previously (the method you choose shouldn't affect your

                        results for the problem as you've described it, There's More Than One

                        Way To Do It, etc).

                        For each row/record of the excel file, if the value of the second

                        column is "yes," check if the value in the first column is in

                        %lettersHash. If it is, output the letter. If not, read the next

                        record.



                        On the other hand, if you want to do something more complicated (like

                        if the order of the second file matters -- say you only output the

                        letter if row N of the excel file says "A Yes" and row N of the second

                        file says "A"), then please describe your problem in more detail.



                        good luck,

                        jeff



                        On Mon, Jan 25, 2010 at 9:22 PM, gopi chand <gopichand84@ yahoo.com> wrote:

                        >

                        >

                        > Thanks for the reply Jeff.

                        >

                        > I don't want to print all the letters in the first column which have an "yes" in second column,I only want to print the ones in sample.txt file,how are we taking care of this condition?

                        >

                        >

                        > --- On Mon, 1/25/10, Jeff Soules <soules@gmail. com> wrote:

                        >

                        > From: Jeff Soules <soules@gmail. com>

                        > Subject: Re: [PBML] Perl script to read

                        > To: "perl-beginner@ yahoogroups. com" <perl-beginner@ yahoogroups. com>

                        > Date: Monday, January 25, 2010, 6:01 PM

                        >

                        >

                        >

                        > I would begin by saving the excel file in a plain text format. Tab-

                        > delimited would likely work well, if this is a complete description of

                        > the doc (if there aren't any tabs or anything).

                        >

                        > Then I would read the file in line by line and use split to get the

                        > two columns (these are 2 columns right?) into separate fields. Use

                        > regex or string comparison (eq) to see if the second field is yes, and

                        > if it is, print the first field.

                        >

                        > There are no doubt more robust solutions, but something along these

                        > lines ought to get you started if it's just a quickie.

                        >

                        > Good luck.

                        >

                        > On Jan 25, 2010, at 8:39 PM, "GoPi" <gopichand84@ yahoo.com> wrote:

                        >

                        > > Hi friends,

                        > >

                        > > Hopeeveryone is doing good.

                        > >

                        > > 1.I have an excel sheet in 2003 with columns like below

                        > >

                        > > A Yes

                        > > B No

                        > > C Yes

                        > > D Yes

                        > >

                        > > 2.I have a file "sample.txt" which contains all the leters like below

                        > >

                        > > A

                        > > B

                        > > C

                        > > D

                        > >

                        > > Now,I my objective is to write a perl script to output only the

                        > > letters that are listed as "Yes" in my excel sheet.Can some pls help

                        > > to give me a starting point?

                        > >

                        > > Thanks























                        [Non-text portions of this message have been removed]
                      Your message has been successfully submitted and would be delivered to recipients shortly.