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

counting the words using perl programing

Expand Messages
  • sravul
    I have a file that has the following content: A 35 rose flower rose flower rose bud lavender flower lavender leaf lavender flower B 36 Lotus flower lotus bud
    Message 1 of 1 , Jun 2, 2003
    • 0 Attachment
      I have a file that has the following content:
      A 35
      rose flower
      rose flower
      rose bud
      lavender flower
      lavender leaf
      lavender flower
      B 36
      Lotus flower
      lotus bud
      lotus leaf
      lotus flower
      In this file A 35 and B 36 are the headings.Under the heading A 35 I
      have the following content:
      rose flower
      rose flower
      rose bud
      etc
      and under heading B 36 i have the following content:
      Lotus flower
      lotus bud
      lotus leaf
      etc
      My task is to count the first and second word under each heading and
      sum it up.So the my out put must look like this:
      A 35
      rose 3
      lavander 3
      flower 4
      bud 1
      leaf 1
      A 36
      Lotus 4
      flower 2
      bud 1
      leaf 1

      I have posted this sometime back but Could not explain it well hence i
      am posting it again.I need help with this script.
    Your message has been successfully submitted and would be delivered to recipients shortly.