<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script to select text from a line in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046325#M433956</link>
    <description>Hi Luk,&lt;BR /&gt;&lt;BR /&gt;try something like this, using your file as $1:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;        STRING1=$(echo ${line%%www\.*})&lt;BR /&gt;        STRING2=$(echo "${line#$STRING1}" )&lt;BR /&gt;        STRING3=$(echo ${STRING2##*\.com})&lt;BR /&gt;        echo ${STRING2%$STRING3}&lt;BR /&gt;done &amp;lt;$1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
    <pubDate>Mon, 14 May 2007 04:01:08 GMT</pubDate>
    <dc:creator>john korterman</dc:creator>
    <dc:date>2007-05-14T04:01:08Z</dc:date>
    <item>
      <title>Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046322#M433953</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have the following question.&lt;BR /&gt;I have a file with several lines in it.&lt;BR /&gt;In each line a have the adress off a website, not on a fixed position.  I need a script / command to filter out this website.&lt;BR /&gt;&lt;BR /&gt;fe&lt;BR /&gt;The file contains&lt;BR /&gt;&lt;BR /&gt;aeratarawww.hp.comqmlkmlk&lt;BR /&gt;qdfdwww.google.commmkkm&lt;BR /&gt;arewww.gmail.com kmkùkù&lt;BR /&gt;&lt;BR /&gt;I need as output only&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hp.com" target="_blank"&gt;www.hp.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.google.com" target="_blank"&gt;www.google.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.gmail.com" target="_blank"&gt;www.gmail.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Please advise</description>
      <pubDate>Mon, 14 May 2007 01:36:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046322#M433953</guid>
      <dc:creator>Luk Vandenbussche</dc:creator>
      <dc:date>2007-05-14T01:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046323#M433954</link>
      <description>Below is not perfect, but may work for the example.&lt;BR /&gt;&lt;BR /&gt;sed -e 's/^.*www\./www\./' -e 's/\.com.*$/\.com/' filename</description>
      <pubDate>Mon, 14 May 2007 01:57:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046323#M433954</guid>
      <dc:creator>Masatake Hanayama</dc:creator>
      <dc:date>2007-05-14T01:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046324#M433955</link>
      <description>If they start with www. and end in .com you can use:&lt;BR /&gt;sed -e 's/*.\(www\..*\.com\).*$/\1/' filename</description>
      <pubDate>Mon, 14 May 2007 02:11:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046324#M433955</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-14T02:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046325#M433956</link>
      <description>Hi Luk,&lt;BR /&gt;&lt;BR /&gt;try something like this, using your file as $1:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;        STRING1=$(echo ${line%%www\.*})&lt;BR /&gt;        STRING2=$(echo "${line#$STRING1}" )&lt;BR /&gt;        STRING3=$(echo ${STRING2##*\.com})&lt;BR /&gt;        echo ${STRING2%$STRING3}&lt;BR /&gt;done &amp;lt;$1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Mon, 14 May 2007 04:01:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046325#M433956</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2007-05-14T04:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046326#M433957</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;# awk 'BEGIN {FS="."} {printf "www."$2".com\n"}'  filename&lt;BR /&gt;&lt;A href="http://www.hp.com" target="_blank"&gt;www.hp.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.google.com" target="_blank"&gt;www.google.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.gmail.com" target="_blank"&gt;www.gmail.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 May 2007 04:11:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046326#M433957</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-05-14T04:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046327#M433958</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;With more error checking.&lt;BR /&gt;&lt;BR /&gt;awk -F"." '/www\./ &amp;amp;&amp;amp; /\.com/ {print "www."$2".com"}' filename&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If the file will definitely contain the strings as "&lt;A href="http://www.xxx.com" target="_blank"&gt;www.xxx.com&lt;/A&gt;" form, then here is a more simplified form:&lt;BR /&gt;&lt;BR /&gt;awk -F"." '{print "www."$2".com"}' filename</description>
      <pubDate>Mon, 14 May 2007 05:13:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046327#M433958</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-05-14T05:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046328#M433959</link>
      <description>Luk, what problem are you really trying to solve? If the file comes from a particular file (index.dat) or log then others may have dealt with that before.&lt;BR /&gt;&lt;BR /&gt;I find it unlikely that the www just starts after random text and the .com runs into random text as your example suggests. Is there really no seperator of sorts (whitespace?) If there a field lenght/offset indicator elsewhere in the structure?&lt;BR /&gt;&lt;BR /&gt;If the text is all we have, is the www and .com, and a single field between them a complete description, or does the code also have to trigger on .org, .net and what have you not?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 May 2007 07:11:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046328#M433959</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-05-14T07:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046329#M433960</link>
      <description>Hi Luk,&lt;BR /&gt;&lt;BR /&gt;This sed script is a bit more generic than some of the other solutions:&lt;BR /&gt;&lt;BR /&gt;$ cat urls&lt;BR /&gt;aeratarawww.hp.comqmlkmlk&lt;BR /&gt;qdfdwww.google.commmkkm&lt;BR /&gt;arewww.gmail.com kmkyky&lt;BR /&gt;jkddswww.hello.orgafsdjk&lt;BR /&gt;wjekwjws1.hp.netfds7u8&lt;BR /&gt;weewwemail.dsdsdswww.netsdfjkldskdsj&lt;BR /&gt;wwewuiweweb.ieee.orgfdjkdjdk&lt;BR /&gt;&lt;A href="http://www.ibm.com" target="_blank"&gt;www.ibm.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;$ sed -e 's/^.*\(...\..*\....\).*$/\1/' urls&lt;BR /&gt;&lt;A href="http://www.hp.com" target="_blank"&gt;www.hp.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.google.com" target="_blank"&gt;www.google.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.gmail.com" target="_blank"&gt;www.gmail.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.hello.org" target="_blank"&gt;www.hello.org&lt;/A&gt;&lt;BR /&gt;ws1.hp.net&lt;BR /&gt;ail.dsdsdswww.net&lt;BR /&gt;web.ieee.org&lt;BR /&gt;&lt;A href="http://www.ibm.com" target="_blank"&gt;www.ibm.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Mon, 14 May 2007 08:10:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046329#M433960</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-05-14T08:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select text from a line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046330#M433961</link>
      <description>Thanks for the help</description>
      <pubDate>Mon, 14 May 2007 09:00:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-select-text-from-a-line/m-p/5046330#M433961</guid>
      <dc:creator>Luk Vandenbussche</dc:creator>
      <dc:date>2007-05-14T09:00:03Z</dc:date>
    </item>
  </channel>
</rss>

