RBW wrote:
> I'm a complete noob at Perl so please bear with me... I basically
> cobbled this together.
>
> I'm getting this effect in the output file:
>
> || shExpMatch(url, " ad.be.doubleclick.net
> ")|| shExpMatch(url, " ad.harmony-central.com
> ")|| shExpMatch(url, " ad.img.yahoo.co.kr
> ")|| shExpMatch(url, " ad.sales.olympics.com
> ")
>
> ...
>
> ")|| shExpMatch(url, "adopt.specificclick.net
> ")|| shExpMatch(url, "adpick.switchboard.com
> ")|| shExpMatch(url, "adpulse.ads.targetnet.com
> ")|| shExpMatch(url, "adq.nextag.com
>
> From this perl code:
> #!/usr/bin/perl
> #######################################################
> open(MYINPUTFILE, "<AdBlockList-Hosts-4May06.test"); # open
> for input
> my(@lines) = <MYINPUTFILE>; # read
> file into list
> @lines = sort(@lines); # sort
> the list
> my($line);
>
move the next line
> chomp($line); # I thought
> this was to eliminate the newline in the inputfile...
>
> $appendString = '")';
>
> foreach $line (@lines) # loop
> thru list
> {
to here
(and see what happens)
> print
> "$line"."$appendString";
> # print in sort order
> }
>
> close(MYINPUTFILE);
>
> exit;
>
>
>
> Which is fine but I need each line to look something like this where the
> string '")'; is at the end of the line and there is a newline after
> that, like this:
> || shExpMatch(url, " ad.be.doubleclick.net")
> || shExpMatch(url, " ad.harmony-central.com")
> ...
>
>
> When I am done and everything is cleaned up format wise I am going to
> pipe this long list to a file like so:
> [EMAIL PROTECTED] applications]$./testAppend.pl > outputTestAppend.txt
>
> I think this is just a formatting problem but I'm not sure.
>
> TIA,
> RBW
>
>
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg