🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #3485

Re: Editor to find and replace hidden chars, strip controls?

#3485
From: Bill Whedon
Date: Mon, 05 Oct 1992 01:59
48 lines
2200 bytes
In article <92278.184011RVK@psuvm.psu.edu> <RVK@psuvm.psu.edu> writes:
>Where can I find an editor that can find and replace hidden characters,
>strip control characters and linefeeds?  Essentially, I need to strip a
>large number of linefeeds from a data acquisition file.  Thanks in advance.
>
>Atul Ramani
>PSUVM
>===========
Why bother with an editor?  Here's source for a simple filter which will take
out all CR and LF characters (0x0D and 0x0A) for you:


#include <stdio.h>

int main();
int main()
{
   int c;
   while (EOF != (c=getchar())){
     if ((0x0A == c) || (0x0D == c)){
       continue;
     } else {
       putchar(c);
     }
   }
   return(0);
}

To use it, cut it out, name it something useful like "stripper.c", then
compile and link it (any model will do).  Now, say you have one of your
data files "GOOD.DAT", which has the CR/LF in it:  Just call stripper:

   stripper <good.dat >better.dat

That runs good.dat through stripper.exe (which is really a filter), and
produces better.dat as output, sans CR/LF pairs.  If you really need to
remove only one or the other, just change the "if..." statement as needed.
Enjoy!
Bill Whedon   whedon@netcom.com

-- 
---------------------------------------------------------------------
--           the net, working,                                     --
--           sends mail afar                                       --
--           and we, in cybernetic dream                           --
--           reply                                                 --
--                                                                 --
-------Bill-Whedon------whedon@netcom.com----------------------------
Technical Details
Message-ID: <1992Oct5.015911.3335@netcom.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!spool.mu.edu!umn.edu!csus.edu!netcom.com!whedon
References: <92278.184011RVK@psuvm.psu.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer,comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!spool.mu.edu!umn.edu!csus.edu!netcom.com!whedon
From: whedon@netcom.com (Bill Whedon)
Subject: Re: Editor to find and replace hidden chars, strip controls?
Message-ID: <1992Oct5.015911.3335@netcom.com>
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
References: <92278.184011RVK@psuvm.psu.edu>
Date: Mon, 5 Oct 1992 01:59:11 GMT
Lines: 48