🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.archives.msdos.d
Article #596

Re: uniq.zip - Remove or report adjacent duplicate lines

#596
From: Russell Schulz
Date: Sun, 12 Jun 1994 03:16
65 lines
1961 bytes
Archive-name: uniq.pas
Submitted-by: russell@alpha3.ersys.edmonton.ab.ca

in comp.archives.msdos.d mathews@ncgl.gsfc.nasa.gov (Jason Mathews) writes:

> uniq.zip        Remove or report adjacent duplicate lines
> 
> ShareWare.

{handles stdin only, lines <=255 chars}
{use -v to print only duplicated lines}
{use -20 to check only first 20 chars}

program uniq;

var
  s: string;
  last: string;
  checklen: integer;
  shownew: boolean;
  arg: integer;
  isnew: boolean;
  code: word;
  bof: boolean;

begin

  checklen := 255;
  shownew := true;

  for arg := 1 to paramcount do
    begin
      if copy(paramstr(arg),1,1)='-' then
        begin
          if paramstr(arg)='-v' then
            shownew := false
          else
            val(copy(paramstr(arg),2,255),checklen,code);
        end;
    end;

  last := '';
  bof := true;

  while not eof do
    begin

      readln(s);

      if bof then
        isnew := true
      else
        isnew := (copy(s,1,checklen)<>copy(last,1,checklen));

      if isnew=shownew then
        writeln(s);

      last := s;

      bof := false;
    end;

end.
-- 
Russell Schulz  russell@alpha3.ersys.edmonton.ab.ca  ersys!rschulz  Shad 86c
Technical Details
Message-ID: <940611.211611.1N7.rusnews.w164w@alpha3.ersys.edmonton.ab.ca>
Path: arc1-ca.pugleaf.net!wupost!math.ohio-state.edu!cyber2.cyberstore.ca!nntp.cs.ubc.ca!alberta!bigbrd!crs-sys!ersys!alpha3!russell
References: <9406070447.kp14814@SimTel.Coast.NET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!math.ohio-state.edu!cyber2.cyberstore.ca!nntp.cs.ubc.ca!alberta!bigbrd!crs-sys!ersys!alpha3!russell
From: russell@alpha3.ersys.edmonton.ab.ca (Russell Schulz)
Newsgroups: comp.archives.msdos.d,alt.sources,comp.lang.pascal
Subject: Re: uniq.zip - Remove or report adjacent duplicate lines
Message-ID: <940611.211611.1N7.rusnews.w164w@alpha3.ersys.edmonton.ab.ca>
Date: Sat, 11 Jun 1994 21:16:11 -0600
References: <9406070447.kp14814@SimTel.Coast.NET>
Reply-To: russell@alpha3.ersys.edmonton.ab.ca (Russell Schulz)
Followup-To: comp.lang.pascal
Organization: Private System, Edmonton, AB, Canada
X-Original-Newsgroups: comp.archives.msdos.announce
X-Newsreader: rusnews v1.11+
Lines: 65