Linux Newbie help
 help / color / mirror / Atom feed
From: Stephen Samuel <samuel@bcgreen.com>
To: Peter <pfheiss@philonline.com>
Cc: linux-newbie@vger.kernel.org
Subject: Re: Text Reformatting
Date: Tue, 20 May 2003 02:59:28 -0700	[thread overview]
Message-ID: <3EC9FC80.7070407@bcgreen.com> (raw)
In-Reply-To: <20030520024710.972F9103B1@pfheiss>

Peter wrote:
> Thanks Stephen,
> 
> sed 's/^[ \t]+//' file does not work, it changes nothing.
> 
> 
> samuel@bcgreen.com said:
> 
>>Note that when you do the " tr [options] > somefile | fmt [options]
>>somefile" , you're losing any advantage of using a pipe. 
> 
> 
> Well taken tip!
> 
> Regards

Grr... I forgot the backslash before the '+'   That should be:

sed 's/^[ \t]\+//' file

(you could also do
	sed 's/^[ \t]*//' file


The '+' construct is (technically) a bit more efficient -- it won't
do a  null replacement for an unindented line.  It is, however, an
extended pattern and I sometimes worry about it's portability to
older (non-gnu) versions of sed. Ha! but never mind! Even that \t
turns out not to be portable to BSD. you need to have the literal
'tab' character.  It turns out that the most portable form is:

sed 's/^[ 	]*//' file
(with a space and a tabe between the sqquare brackets).  You might
need to do a ctrl-v o get bash to accept the tab caracter.

-- 
Stephen Samuel +1(604)876-0426                samuel@bcgreen.com
		   http://www.bcgreen.com/~samuel/
Powerful committed communication, reaching through fear, uncertainty and
doubt to touch the jewel within each person and bring it to life.

-
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:[~2003-05-20  9:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <pfheiss@philonline.com>
2003-05-18  4:11 ` Text Reformatting Peter
2003-05-18  4:23   ` CaT
2003-05-18  4:23   ` raihan
2003-05-18  7:54   ` John Kelly
2003-05-19 15:44   ` Stephen Samuel
2003-05-20  2:47     ` Peter
2003-05-20  9:59       ` Stephen Samuel [this message]
2003-05-19  2:25 Peter
2003-05-19 12:17 ` Amin
2003-05-20  2:46   ` Peter

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=3EC9FC80.7070407@bcgreen.com \
    --to=samuel@bcgreen.com \
    --cc=linux-newbie@vger.kernel.org \
    --cc=pfheiss@philonline.com \
    /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