public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Bambach <eric@cisu.net>
To: James Miller <jamtat@mailsnare.net>
Cc: linux-newbie@vger.kernel.org
Subject: Re: how to replace three spaces with tab
Date: Thu, 2 Jun 2005 17:40:01 -0500	[thread overview]
Message-ID: <200506021740.01816.eric@cisu.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0506021711350.7223@localhost.localdomain>

sed 's/   /\t/' largefile.txt > largefile.edited

Notice that s/(Three spaces)/(special Tab character sequence)/

This will replace ALL occurances of 3 spaces in your file. Make sure you dont 
have 3 spaces in any other context or those will be changed too. It will 
output to a new file in case i didnt get it right ;)

On Thursday 02 June 2005 05:11 pm, James Miller wrote:
> Here's another example of what looks like something that should be fairly
> straightforward but which I've been struggling with for at least an hour
> and cannot find an answer. I ran into this before and was similarly
> stumped, so I did it all manually. This time I just want to get it done
> and finally find out the secret, my ignorance, or whether this really is
> one of those irresolvable riddles of (Linux) life.
>
> I have a document that consists of about 5,500 entries, each on its own
> line. If this matters, it's a block file to block out advertising by
> resolving certain domains to the localhost (127.0.0.1). In each line of
> the file as I saved it, there are three space characters between the IP
> and the domain name (damn that elinks browser for doing that!). For my
> router to effectively use the file, each of those 5,500 three-space
> sequences need to be changed to a tab sequence--like when you press the
> tab key while typing in a document. How can I automate this?
>
> I know how I'd do it in Word, but I've sworn off that sorry excuse for a
> piece of software (those guys in Redmond will be jumping with glee when
> they read this one: man with naive open source principles walks off Linux
> precipice). None of the Linux equivalents I've tried (Abiword, OpenOffice,
> gedit, nano) gives any indication of how a tab character can be inserted
> in their search-and-replace feature. There are no formatting characters to
> select, as they call them in smarmy M$ speak. The search-and-replace
> dialogues all understand hitting the tab key as the user wanting to move
> to the next field, not as data entry. There's probably a simple command
> line way to do this, but if I were adept enough at simple command line
> stuff, I'd have found it already. Can anyone offer pointers on how to
> automate replacement of the 5,500 three-space sequences with a tab
> sequence?
>
> Thanks, James
>
> -------------------------------------------------------------------+
> If you hit the "reply" button in your email client to respond to my
> message, be sure to remove the REMOVETHIS portion of my email address
> (inserted as an anti-spam tactic). If you don't, your message won't
> reach me.
> -------------------------------------------------------------------+
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs

-- 
----------------------------------------
--EB

> All is fine except that I can reliably "oops" it simply by trying to read
> from /proc/apm (e.g. cat /proc/apm).
> oops output and ksymoops-2.3.4 output is attached.
> Is there anything else I can contribute?

The latitude and longtitude of the bios writers current position, and
a ballistic missile.

                --Alan Cox LKML-December 08,2000 

----------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  reply	other threads:[~2005-06-02 22:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-02 22:11 how to replace three spaces with tab James Miller
2005-06-02 22:40 ` Eric Bambach [this message]
2005-06-02 23:35   ` James Miller
2005-06-03  0:07     ` Eric Bambach
2005-06-03 10:08       ` J.
2005-06-04  5:11       ` Franklin Chua
2005-06-04  6:39         ` J.
2005-06-04 11:05         ` James Miller
2005-06-04 12:13           ` zavandi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200506021740.01816.eric@cisu.net \
    --to=eric@cisu.net \
    --cc=jamtat@mailsnare.net \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox