[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



A great tool no one uses much anymore:

echo <a  rel="nofollow" href="http://addr:port/page";>http://addr:port/page</a>|
         awk -F'[:/]' '{for (i = 2; i&lt;=NF; i++) printf &quot;%s &quot;, $i;}'

OR in perl:

#!/usr/bin/perl -w

use strict;

my $string = &quot;<a  rel="nofollow" href="http://addr:port/page&quot";>http://addr:port/page&quot</a>;;


my ($http, undef, undef, $addr, $port, $page, $rest) =
         split(/[\/:]/, $string);
 

print &quot;http is $http, addr is $addr, port is $port, page $page\n&quot;;



You'll have to deal with the possibility that there is not a port, 
therefore shift stuff when there is no second ':' in the string.

-- 
Until later, Geoffrey


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00171" href="msg00171.html">[ale] Extraction of address and pages</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00175.html">[ale] ps without threads</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00177.html">[ale] ps without threads</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00174.html">[ale] Extraction of address and pages</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00187.html">[ale] Extraction of address and pages</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00176"><strong>Date</strong></a></li>
<li><a href="threads.html#00176"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>