[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: I'm an idiot and sed proves it...



On Wed, 26 Nov 1997, Dale Scheetz wrote:

> Personally, I find the "off topic" threads on this list are often very
> interesting. I almost always learn some new twist or trick that I had not
> seen before, so it is my hope that, when I have problems, the solution may
> be valuable to others as well.

I agree with you here, Dale. It is very refreshing to read the occasional
thread about sed instead of the umpteenth ppp problem saga (no offense to 
people harvesting this list for answers to their ppp problems intended.)

And besides, this hasn't even turned into a sed vs. perl. vs tr vs. who
knows what obscure guineapig-tool...  yet.

> > Your problem is that the inner quotes don't add another level quoting, but
> > take away another level of quoting.  To be a little clearer:
> > 
> > > 	sed -e 's/'\t'/ /g' <infile >outfile
> >                 ^^    ^^^^ are the quoted parts.
> > 
> > The \t is not quoted, but is interpreted by your shell, which replaces the \t
> > with an actual t.  If you take out the inner quotes, it should work:
> >  	sed -e 's/\t/ /g' <infile >outfile

After some messing around, I found that you actualy mustn't escape the tab
to sed, you only have to get it through bash. Just type Ctrl-V TAB and
that puts a tab character in your sed command string. Don't use ' or \
characters at all.

The other problem has me puzzled: you can easily remove the trailing -
from any line with the 's/-$//g' command, but I don't know how to get rid
of the newlines. I'm even looking in the sed&awk book and I still don't
get a clue :-(

Before people start flooding this thread with nifty perl one-liners, I
would really like to see how this is done with sed.

Cheers,


Joost

PS: I think I found something that you can do with the N command. I'm not
going to try it now because it's time to go home. Maybe later unless
someone already solves it today.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: