Subject: Re: Help with Win -> NetBSD text files...
To: Claude Marinier <claude.marinier@dreo.dnd.ca>
From: Eric Fox <eric@fox.phoenix.az.us>
List: netbsd-help
Date: 03/20/2001 07:27:00
On Tue, 20 Mar 2001, Claude Marinier wrote:
> Eric,
>
> On Mon, 19 Mar 2001, Eric Fox wrote:
> > I end up working with a lot of HTML that originated on windoze
> > machines. In order to make life easier I usually process them with
> > one of these short scripts to add/remove the CRLF insanity depending
> > on where I'm moving the file. Hope this helps some.
>
> I have a few questions.
>
> > CRLF=`/usr/bin/printf "\015"`
> > cat $1 | sed "s/${CRLF}//g" >$TMP
> > cat $TMP >$1
>
> I thought that the LF was not visible to 'sed'. The name of the CRLF
> variable implies that it contains two characters. The way you use it
> implies that there will be no LF characters in the file after the 'sed'
> command is done. Am I misreading the code?
Basically, we don't care about the LF, or newline, characters -- we want
them to remain in the file. The character that causes problems is the
CR, or carriage return, character. I CRLF as a variable name simply
because that's what it's called in DOS.
>
> What is the advantage of 'cat' and a pipe as opposed to just 'sed'
> with an argument (first 'cat') or using 'cp' (second 'cat')?
None -- I wrote these scripts a long, long time ago. It could have easily
been perfomed with redirects ... might be a micron faster too.
>
> Thanks.
>
> By the way, I have use calvin and GVim on the Windows system. I have also
> used PFE and recommend it for those who do not know vi.
>
> --
> Claude Marinier, Information Technology Group claude.marinier@dreo.dnd.ca
> Defence Research Establishment Ottawa (DREO) (613) 998-4901 FAX 998-2675
> 3701 Carling Avenue, Ottawa, Ontario K1A 0Z4 http://www.dreo.dnd.ca
>
>