Re: I'm an idiot and sed proves it...
On Wed, 26 Nov 1997, Dale Scheetz wrote:
> I've been trying to use sed to do some editing of simple characters from a
> large block of ascii text. The text has tabs that I wish to replace with
> spaces, and hyphonated words wrapped across linefeeds that I also wish to
> For the tabs, I try the following:
> sed -e 's/'\t'/ /g' <infile >outfile
> Which very cleanly places every t in the document with a space!??
I don't know for certain that this is the problem, but all those '
characters look very suspicious. I think what is happening is the \t
sequence is not getting protected from the shell, which is probably going
to great pains to replace it with the literal character t, since \ (I
think) tells the shell to escape the next character. When sed gets hold
of the string, it sees t instead of \t (which I assume means tab). The
first thing I would try would be using \\t in place of \t, although a
cleaner solution would probably involve rearranging you ' characters
> For the hyphonation I try:
> sed -e 's/-'\n'//g' <infile >outfile
I'm not quite sure what is going on here. I do know that some programs
(like grep) seem to behave strangely when you try to deal with things at
the end of lines. By default, they want to use the end of line character
for their own insidious purposes. I had this problem myself once trying
to fix up some Win95 m files from matlab for octave.
> and although the file gets slightly smaller (I didn't try to find out just
> what had been removed) none of the hyphonated text is corrected.
> I read the man page on sed, which pointed me to the backslash "special"
> characters, but gave no examples of their use. I have tried to figure this
> out looking at other examples, but am not making any headway.
> While I am positive that my problem is simple, I'm too much of an idiot to
> figure it out on my own. Can someone point me in the right direction?
> Thanks in advance,
> _-_-_-_-_-_- _-_-_-_-_-_-_-
> aka Dale Scheetz Phone: 1 (904) 656-9769
> Flexible Software 11000 McCrackin Road
> e-mail: email@example.com Tallahassee, FL 32308
> _-_-_-_-_-_- If you don't see what you want, just ask _-_-_-_-_-_-_-
> TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
> firstname.lastname@example.org .
> Trouble? e-mail to email@example.com .
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to firstname.lastname@example.org .