Pádraig Brady wrote: > Pascal wrote: > > cat - "concatenate files and print on the standard output" - > > offers -s option to suppress repeated empty lines. > > > > However, an "empty" line (visual perspective) that behave only > > spaces or tabs is not considered as empty : one option -S that > > would address this scenario should be added to cat... > > > > I hope to be clear :-) > > While it's a fair suggestion, I'd be against adding this functionality to cat > as it's outside of its core functionality. > > Now even `cat -s` is debatable, but at least that is also implemented in > FreeBSD > and is an awkward enough operation to do in sed for example: > http://www.gnu.org/software/sed/manual/html_node/cat-_002ds.html > > However a simple additional sed operation would suffice to implement -S. > Something like: sed 's/^ *$//' | cat -s > > So I'd be 70:30 against implementing this.
I would also vote against this functionality. http://harmful.cat-v.org/cat-v/ Rob Pike wrote: > The talk reviews reasons for UNIX's popularity and shows, using UCB > cat as a primary example, how UNIX has grown fat. cat isn't for > printing files with line numbers, it isn't for compressing multiple > blank lines, it's not for looking at non-printing ASCII characters, > it's for concatenating files. Additionally I will note that on in some systems (at least SunOS) 'cat -s' does not squeeze lines but suppresses errors about non-existent files. It is terribly non-portable. Using --squeeze-blank at least will noisily break if not using a compatible cat program. Bob
