Re: I'm an idiot and sed proves it...
On Wed, 26 Nov 1997, Dale Scheetz wrote:
: On Wed, 26 Nov 1997, Aaron Denney wrote:
:
: > dwarf@polaris.net wrote:
: > > sed -e 's/-'\n'//g' <infile >outfile
: > >
: > > 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.
: >
[ snip ]
: > 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
: >
: > This will pass an actual \t to sed, which will interpret it as a tab character.
: >
: I think that I will never understand the ins and outs of these quoting
: issues. However, this doesn't provide any better fix for my problem.
: Removing the inner quotes results in sed carefully replacing all t
: characters by the space character, and doing nothing to the tabs. (This
: was, after all, my first try, before I went looking at examples and tried
: the inner quotes. Your assurances didn't make it work any better the
: second or third time I tried it either.)
:
: If all that sounds like whining and complaining, I want to make it quite
: clear that I greatly appreciate the help provided.
I think you are having problems because bash won't let you type a tab at
the command line (I think there's a way to do it but I haven't memorised
the manpage yet). At any rate, sed can be invoked with the -e option
and commands on the command line, yes, but it can also be invoked with
the -f option followed by a filename containing your sed command(s).
I tried your example and got the same results - it took away the 't'
character. I then created a text file called 'sedscr' with vi. That
file contained the following text:
s/ / /g
^^^^^^^ this is a tab, not a bunch of spaces
I then typed 'sed -f sedscr <infile>outfile
It worked as advertised. Hope that's what you wanted :)
ps I too thought sed interpreted a '\t' as a tab. Apparently this is
not the case ... perl does, but sed does not. Oh well.
:
: Thanks,
:
: Dwarf
: --
: _-_-_-_-_-_- _-_-_-_-_-_-_-
:
: aka Dale Scheetz Phone: 1 (904) 656-9769
: Flexible Software 11000 McCrackin Road
: e-mail: dwarf@polaris.net Tallahassee, FL 32308
:
: _-_-_-_-_-_- If you don't see what you want, just ask _-_-_-_-_-_-_-
:
--
Nathan Norman
MidcoNet - 410 South Phillips Avenue - Sioux Falls, SD 57104
Voice: (605) 334-4454 Fax: (605) 335-1173
email: nnorman@midco.net or nathan_norman@mmi.net
PGP Key ID: 0xA33B86E9 - Public key available at keyservers
PGP Key fingerprint: CE03 10AF 3281 1858 9D32 C2AB 936D C472
--
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: