delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/10/17:59:12

From: Dave Pearson <davep AT hagbard DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Off behaviour with 'cat -b'
Date: Fri, 10 Jan 1997 13:25:52 GMT
Organization: Hagbard's World (A Private Internet Host)
Lines: 77
Sender: usenet AT hagbard DOT demon DOT co DOT uk
Message-ID: <slrn5dcgqu.jsu.davep@hagbard.demon.co.uk>
Summary: cat -b appears to break when going thru a pipe
Keywords: DJGPP GNU CAT TEXTUTILS textutils-1.19
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I wonder of anyone can comment on this? There appears to be an odd bug
with the version of cat in the DJGPP textutils distribution concerning
the use of the '-b' switch.

Try this:

----------------------------------------------------------------------
C:\>cat --version
cat - GNU textutils-1.19

C:\>cat > foo
This is line 1

This is line 2

This is line 3
^Z

C:\>cat -b foo
     1  this is line 1

     2  this is line 2

     3  this is line 3

C:\>cat -b foo | cat
     1  this is line 1
     2
     3  this is line 2
     4  
     5  this is line 3
----------------------------------------------------------------------

It looks as if the -b is ignored when you redirect or pipe the output.
Testing this on my Linux box:

----------------------------------------------------------------------
davep:~$cat --version
GNU textutils 1.9
davep:~$cat > foo
this is line 1

this is line 2

this is line 3
davep:~$cat -b foo
     1	this is line 1

     2	this is line 2

     3	this is line 3
davep:~$cat -b foo | cat
     1	this is line 1

     2	this is line 2

     3	this is line 3
davep:~$
----------------------------------------------------------------------

As you can see, on my Linux box, it does what you'd expect it to do.
However, I currently have an older version of textutils on there so
perhaps that has something to do with it?

One other thing I've noticed with cat (not tested it with anything
else) is that if you are cating a large file and you press Ctrl-C,
rather than breaking, it appears to go to the start of the file and
re-starts the output again. Only when it gets to the end of the file
do you get a "Exiting due to signal SIGINT". Is this correct
behaviour?

-- 
Take a look in Hagbard's World: |     w3ng - The WWW Norton Guide reader.
http://www.acemake.com/hagbard  |  ng2html - The NG to HTML converter.
Also available in the UK:       |       eg - Norton Guide reader for OS/2.
http://www.hagbard.demon.co.uk  |   dgscan - DGROUP scanner for Clipper.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019