[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sed Suggestion
From: |
Jason Van Cleve |
Subject: |
sed Suggestion |
Date: |
Wed, 8 Jun 2005 11:13:06 -0700 |
Hi,
I've been trying to contact someone for weeks regarding an issue ran
into with sed. I was trying to use sed to strip whitespace from the
ends of lines in my source code tree, using the regex "$" symbol. Some
of those files have DOS newlines, and sed was quietly failing those. I
learned the hard way what was going wrong, and eventually I employed the
dos2unix tool to work around it.
The trouble is, the hard way was the only way for me, since I could not
divine that "$" in unix regex'es means unix newlines only, not DOS or
Mac newlines. I have found no documentation addressing this obscure
little gotcha, other than a passing mention of the DOS version of sed
supporting DOS newlines, etc., and I understand the historical reasons
for this. But the advance of networking has made DOS-formatted files
more ubiquitous on unix-like systems, and I feel the developers of sed
really ought to address the problem in some way.
My preference would be the addition of a command-line option that will
enable "$" to match all three newline sequences at once. This would be
most expedient, since I wouldn't need an intermediate dos2unix
invocation, and it would preserve backward compatibility.
Barring that, I suggest you add just a small paragraph in the man page
pointing out this pitfall, which would have saved me some hours of
research and discussion (not to mention some face). I sent a draft of
this text to someone in a email now submerged in my archives. If you
like, I'll dig that up and pass it on, but I'm not even sure I'm talking
to the right people yet. I do hope someone is still maintaining sed,
considering entire books on it are still in print.
Thanks for your attention,
Jason Van Cleve
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- sed Suggestion,
Jason Van Cleve <=