Find the answer to your Linux question:
Results 1 to 7 of 7
Following is input: <P align="justify" ><FONT size="+1" color="#221E1F">the tiny bundles of hairs that protrude from them. Waves in the fluid of the inner ear stimulate the hair cells. Like the ...
  1. #1
    Just Joined!
    Join Date
    Dec 2008
    Posts
    3

    Need help to extract <P> tags in a custom manner from below mwntioned input.

    Following is input:

    <P
    align="justify"
    ><FONT size="+1" color="#221E1F">the tiny bundles of hairs that protrude from them. Waves in the fluid of the inner ear stimulate the hair cells. Like the rods and cones in the eye, the hair cells convert this physical stimulation into neural im<FONT size="+1" color="#221E1F">pulses that are sent to the brain (Hudspeth, 2000). </P
    ><P
    align="justify"
    >These signals are routed through the thalamus to the auditory cortex, which is located mostly in the temporal lobes of the brain. Studies demonstrate that the auditory cortex has specialized cells&mdash;similar to the feature detectors found in the visual cortex&mdash;that have special sensitivity to certain features of sound (Pickles, 198. Evidence also suggests that the parallel processing of input seen in the visual system also occurs in the auditory pathways (Rouiller, 1997). </P
    ><DIV class="Part"

    ><DIV class="Sect"

    ><H4
    align="justify"
    ><FONT size="+1" color="#8E2E33"><B>Auditory Perception: Theories of Hearing </H4
    ><P

    ><FONT size="+1" color="#007AA4">Figure 4.50 <FONT size="+1">The basilar membrane.<FONT size="+1" color="#221E1F"> This graphic shows how the cochlea might look if it were un<FONT size="+1"><B>wound and cut open to reveal the basilar membrane, which is covered with thousands of hair cells (the auditory receptors). Pressure waves in the fl uid filling the cochlea cause oscillations to travel in waves down the basilar membrane, stimulating the hair cells to fi re. Although the entire membrane vibrates, as predicted by frequency theory, the point along the membrane where the wave peaks depends on the frequency of the sound stimulus, as suggested by place theory. </P
    ><IMG align="" width="339" height="240"
    src="http://www.unix.com/images/a_img_0.jpg" ></DIV
    ></DIV
    ></DIV
    >


    My output requirements are:
    1. To strip all attributes within <P> tags keeping <B> and <I> tag within data.
    2. Delete all attribute within H4 tags and replace resulting <H4> tag with <P> tag.
    3. Delete outer <Div> tags surrounding <P> tags.

    So my OUTPUT will be:

    <P>the tiny bundles of hairs that protrude from them. Waves in the fluid of the inner ear stimulate the hair cells. Like the rods and cones in the eye, the hair cells convert this physical stimulation into neural impulses that are sent to the brain (Hudspeth, 2000).</P>
    <P>These signals are routed through the thalamus to the auditory cortex, which is located mostly in the temporal lobes of the brain. Studies demonstrate that the auditory cortex has specialized cells&mdash;similar to the feature detectors found in the visual cortex&mdash;that have special sensitivity to certain features of sound (Pickles, 198. Evidence also suggests that the parallel processing of input seen in the visual system also occurs in the auditory pathways (Rouiller, 1997).</P>
    <P>This graphic shows how the cochlea might look if it were un<FONT size="+1"><B>wound and cut open to reveal the basilar membrane, which is covered with thousands of hair cells (the auditory receptors). Pressure waves in the fl uid filling the cochlea cause oscillations to travel in waves down the basilar membrane, stimulating the hair cells to fi re. Although the entire membrane vibrates, as predicted by frequency theory, the point along the membrane where the wave peaks depends on the frequency of the sound stimulus, as suggested by place theory.</P>
    <IMG align="" width="339" height="240" src="http://www.unix.com/images/a_img_0.jpg" >


    Thanks a Ton!!!

  2. #2
    Just Joined!
    Join Date
    Dec 2008
    Posts
    3
    Guys this is realy important for me....So please help ....i will be more than thankful to you!!!!!!!!!

  3. #3
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Well, not many of us are likely to just hang around waiting for programming tasks to do; we have our own! ;)

    But we're usually willing to help with specific questions, because a few minutes of our time goes a long way in getting others unstuck.

    So pick your language of choice, write a script or other program, and see whether it works. If it doesn't, post a reasonably short test program here, along with reasonably short test data, and tell us how you expected it to work and what (exactly what) it did instead.

    Good luck!
    --
    Bill

    Old age and treachery will overcome youth and skill.

  4. #4
    Just Joined!
    Join Date
    Dec 2008
    Posts
    3
    Thanks for response Sir!!! ...but i am new to shell script. I have explained my INPUT and desired OUTPUT above. It would be a great if you can help me in acheiving above output or if you can atleast provide an idea how to do so....

  5. #5
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Are there any language restrictions? Is the input HTML, XML, what?

    If it's X(HT)?ML, it should be very simple to use an XML parser to extract the <p> tags. Otherwise, you'll probably need to do some regular expression magic.

    But yes, as wje says, don't expect to come in and ask us to write a program for you. If you truly have no idea how to start, maybe a good guide to shell scripting would be a good first step.
    DISTRO=Arch
    Registered Linux User #388732

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    maybe a good guide to shell scripting would be a good first step.
    Well said. You might want to google (or better, scroogle) the following search terms to find something that suits you:
    Code:
    bash tutorial
    When you are finished with that, or even while you're working your way through it, you may wish to acquaint yourself with a scripting language liike Perl, python, or ruby.

    At this point in the thread is where everyone should now pile on top of each other and say:

    Perl!

    No! python!

    No! ruby!

    And so forth.

    I'm sure any of them will work, but of course Perl is best. (* ducks and runs*)
    --
    Bill

    Old age and treachery will overcome youth and skill.

  7. #7
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Oh, wait. I forgot. You really want to learn lisp. (Just kidding, maybe.)
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...