9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] in ed, how to do i do this?
@ 2011-06-17 14:55 Fernan Bolando
  2011-06-17 15:04 ` yy
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Fernan Bolando @ 2011-06-17 14:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

1. insert a character in a line? - I usually retype the whole line with .c
2. indent a line - i usually retype the whole line.

fernan



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 14:55 [9fans] in ed, how to do i do this? Fernan Bolando
@ 2011-06-17 15:04 ` yy
  2011-06-17 15:07   ` Fernan Bolando
  2011-06-17 15:11 ` dexen deVries
  2011-06-17 15:17 ` dexen deVries
  2 siblings, 1 reply; 15+ messages in thread
From: yy @ 2011-06-17 15:04 UTC (permalink / raw)
  To: fernanbolando, Fans of the OS Plan 9 from Bell Labs

2011/6/17 Fernan Bolando <fernanbolando@mailc.net>:
> 1. insert a character in a line? - I usually retype the whole line with .c

s/^/c/

> 2. indent a line - i usually retype the whole line.

The same, where c == \t


--
- yiyus || JGL .



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 15:04 ` yy
@ 2011-06-17 15:07   ` Fernan Bolando
  2011-06-17 15:08     ` John Floren
  2011-06-17 15:22     ` Bakul Shah
  0 siblings, 2 replies; 15+ messages in thread
From: Fernan Bolando @ 2011-06-17 15:07 UTC (permalink / raw)
  To: yy; +Cc: Fans of the OS Plan 9 from Bell Labs

On Fri, Jun 17, 2011 at 11:04 PM, yy <yiyu.jgl@gmail.com> wrote:
> 2011/6/17 Fernan Bolando <fernanbolando@mailc.net>:
>> 1. insert a character in a line? - I usually retype the whole line with .c
>
> s/^/c/

what if I want to insert it in the middle of the line?

>
>> 2. indent a line - i usually retype the whole line.
>
> The same, where c == \t
>
>
> --
> - yiyus || JGL .
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 15:07   ` Fernan Bolando
@ 2011-06-17 15:08     ` John Floren
  2011-06-17 15:22     ` Bakul Shah
  1 sibling, 0 replies; 15+ messages in thread
From: John Floren @ 2011-06-17 15:08 UTC (permalink / raw)
  To: fernanbolando, Fans of the OS Plan 9 from Bell Labs

If you want to change:

"in ed, how" to "in fred, how", do something like this:

s/in ed/in fred/


John

On Fri, Jun 17, 2011 at 8:07 AM, Fernan Bolando <fernanbolando@mailc.net> wrote:
> On Fri, Jun 17, 2011 at 11:04 PM, yy <yiyu.jgl@gmail.com> wrote:
>> 2011/6/17 Fernan Bolando <fernanbolando@mailc.net>:
>>> 1. insert a character in a line? - I usually retype the whole line with .c
>>
>> s/^/c/
>
> what if I want to insert it in the middle of the line?
>
>>
>>> 2. indent a line - i usually retype the whole line.
>>
>> The same, where c == \t
>>
>>
>> --
>> - yiyus || JGL .
>>
>
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 14:55 [9fans] in ed, how to do i do this? Fernan Bolando
  2011-06-17 15:04 ` yy
@ 2011-06-17 15:11 ` dexen deVries
  2011-06-17 15:17 ` dexen deVries
  2 siblings, 0 replies; 15+ messages in thread
From: dexen deVries @ 2011-06-17 15:11 UTC (permalink / raw)
  To: fernanbolando, Fans of the OS Plan 9 from Bell Labs

On Friday 17 of June 2011 16:55:41 Fernan Bolando wrote:
> 1. insert a character in a line? - I usually retype the whole line with .c

if you have a line in the form:

> foo bar BAZ frob knob

and want to insert text after BAZ, do:

s,BAZ,&  new text new text,

where the `&' stands for whatever was matched; here BAZ.


-- 
dexen deVries

[[[↓][→]]]

For example, if the first thing in the file is:
   <?kzy irefvba="1.0" rapbqvat="ebg13"?>
an XML parser will recognize that the document is stored in the traditional 
ROT13 encoding.

(( Joe English, http://www.flightlab.com/~joe/sgml/faq-not.txt ))



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 14:55 [9fans] in ed, how to do i do this? Fernan Bolando
  2011-06-17 15:04 ` yy
  2011-06-17 15:11 ` dexen deVries
@ 2011-06-17 15:17 ` dexen deVries
  2011-06-17 22:38   ` Mauricio CA
  2 siblings, 1 reply; 15+ messages in thread
From: dexen deVries @ 2011-06-17 15:17 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Friday 17 of June 2011 16:55:41 Fernan Bolando wrote:
> 2. indent a line - i usually retype the whole line.


to indent several lines, you could do
1) set dot to range, like 1,5
2) s,^, ,g

(a tab between second and third coma)

but that'd indent the empty ones too :(

you want

1) set dot to range, like 1,5
2) s,^.,        &,g

(a tab between second coma and the ampersand)
the `g' means `do it for every line, rather than just the first one'

-- 
dexen deVries

[[[↓][→]]]

For example, if the first thing in the file is:
   <?kzy irefvba="1.0" rapbqvat="ebg13"?>
an XML parser will recognize that the document is stored in the traditional 
ROT13 encoding.

(( Joe English, http://www.flightlab.com/~joe/sgml/faq-not.txt ))



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 15:07   ` Fernan Bolando
  2011-06-17 15:08     ` John Floren
@ 2011-06-17 15:22     ` Bakul Shah
  2011-06-17 15:26       ` Fernan Bolando
                         ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Bakul Shah @ 2011-06-17 15:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Jun 17, 2011, at 8:07 AM, Fernan Bolando <fernanbolando@mailc.net>
wrote:

> On Fri, Jun 17, 2011 at 11:04 PM, yy <yiyu.jgl@gmail.com> wrote:
>> 2011/6/17 Fernan Bolando <fernanbolando@mailc.net>:
>>> 1. insert a character in a line? - I usually retype the whole line
>>> with .c
>>
>> s/^/c/
>
> what if I want to insert it in the middle of the line?

Mousing is faster than typing :-)
>>
>>
>>
>>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 15:22     ` Bakul Shah
@ 2011-06-17 15:26       ` Fernan Bolando
  2011-06-17 15:27       ` dexen deVries
  2011-06-17 16:18       ` Skip Tavakkolian
  2 siblings, 0 replies; 15+ messages in thread
From: Fernan Bolando @ 2011-06-17 15:26 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Jun 17, 2011 at 11:22 PM, Bakul Shah <bakul@bitblocks.com> wrote:
> On Jun 17, 2011, at 8:07 AM, Fernan Bolando <fernanbolando@mailc.net> wrote:
>
>> On Fri, Jun 17, 2011 at 11:04 PM, yy <yiyu.jgl@gmail.com> wrote:
>>>
>>> 2011/6/17 Fernan Bolando <fernanbolando@mailc.net>:
>>>>
>>>> 1. insert a character in a line? - I usually retype the whole line with
>>>> .c
>>>
>>> s/^/c/
>>
>> what if I want to insert it in the middle of the line?
>
> Mousing is faster than typing :-)
>>>
yeah, reading that thread reminded me of my problem inserting text in
lines when I needed to use ed.
thanks to all that responded.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 15:22     ` Bakul Shah
  2011-06-17 15:26       ` Fernan Bolando
@ 2011-06-17 15:27       ` dexen deVries
  2011-06-17 16:18       ` Skip Tavakkolian
  2 siblings, 0 replies; 15+ messages in thread
From: dexen deVries @ 2011-06-17 15:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Friday 17 of June 2011 17:22:37 Bakul Shah wrote:
> On Jun 17, 2011, at 8:07 AM, Fernan Bolando <fernanbolando@mailc.net>
>
> wrote:
> > On Fri, Jun 17, 2011 at 11:04 PM, yy <yiyu.jgl@gmail.com> wrote:
> >> 2011/6/17 Fernan Bolando <fernanbolando@mailc.net>:
> >>> 1. insert a character in a line? - I usually retype the whole line
> >>> with .c
> >>
> >> s/^/c/
> >
> > what if I want to insert it in the middle of the line?
>
> Mousing is faster than typing :-)

and 9fans is faster than manpages ;-)






^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 15:22     ` Bakul Shah
  2011-06-17 15:26       ` Fernan Bolando
  2011-06-17 15:27       ` dexen deVries
@ 2011-06-17 16:18       ` Skip Tavakkolian
  2011-06-17 16:31         ` dexen deVries
  2 siblings, 1 reply; 15+ messages in thread
From: Skip Tavakkolian @ 2011-06-17 16:18 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

mousing is faster if ed is running in a rio window :)

On Fri, Jun 17, 2011 at 8:22 AM, Bakul Shah <bakul@bitblocks.com> wrote:
> On Jun 17, 2011, at 8:07 AM, Fernan Bolando <fernanbolando@mailc.net> wrote:
>
>> On Fri, Jun 17, 2011 at 11:04 PM, yy <yiyu.jgl@gmail.com> wrote:
>>>
>>> 2011/6/17 Fernan Bolando <fernanbolando@mailc.net>:
>>>>
>>>> 1. insert a character in a line? - I usually retype the whole line with
>>>> .c
>>>
>>> s/^/c/
>>
>> what if I want to insert it in the middle of the line?
>
> Mousing is faster than typing :-)
>>>
>>>
>>>
>>>
>
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 16:18       ` Skip Tavakkolian
@ 2011-06-17 16:31         ` dexen deVries
  0 siblings, 0 replies; 15+ messages in thread
From: dexen deVries @ 2011-06-17 16:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Friday 17 of June 2011 18:18:14 Skip Tavakkolian wrote:
> mousing is faster if ed is running in a rio window :)

back when I was text-moder on an 486, mouse via gpm was quite a speed-up for 
work in Midnight Commander and CLI [1]
but porting gpm to p9 would require cursor addressing, you don't what that.



[1] yea, yea, bash completio. linux normally have several virtual terminals... 
but bash is oblivious to whatever happens on other ones. and grepping 
/dev/<virtual-terminal> is, well... :P

--
dexen deVries

[[[↓][→]]]

For example, if the first thing in the file is:
   <?kzy irefvba="1.0" rapbqvat="ebg13"?>
an XML parser will recognize that the document is stored in the traditional 
ROT13 encoding.

(( Joe English, http://www.flightlab.com/~joe/sgml/faq-not.txt ))



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 15:17 ` dexen deVries
@ 2011-06-17 22:38   ` Mauricio CA
  2011-06-18  1:05     ` Rob Pike
  0 siblings, 1 reply; 15+ messages in thread
From: Mauricio CA @ 2011-06-17 22:38 UTC (permalink / raw)
  To: 9fans

> to indent several lines, you could do
> 1) set dot to range, like 1,5
> 2) s,^, ,g

I believe you can't set dot to a range in ed, just to a single line. Your
sugestion applies to sam, though. In ed, you should give range with
command:

1,5s,^,	,g

Best,
Maurício





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-17 22:38   ` Mauricio CA
@ 2011-06-18  1:05     ` Rob Pike
  2011-06-19 14:11       ` Thomas
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Pike @ 2011-06-18  1:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

As the guy who literally wrote the book on this, please may I
recommend some offline reading?

-rob



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-18  1:05     ` Rob Pike
@ 2011-06-19 14:11       ` Thomas
  2011-07-04  0:58         ` Josh Marshall
  0 siblings, 1 reply; 15+ messages in thread
From: Thomas @ 2011-06-19 14:11 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


As a guy who first read the book around 40 years ago, I can endorse the recommendation.

-tom

On Jun 17, 2011, at 9:05 PM, Rob Pike wrote:

> As the guy who literally wrote the book on this, please may I
> recommend some offline reading?
> 
> -rob
> 




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] in ed, how to do i do this?
  2011-06-19 14:11       ` Thomas
@ 2011-07-04  0:58         ` Josh Marshall
  0 siblings, 0 replies; 15+ messages in thread
From: Josh Marshall @ 2011-07-04  0:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

As a guy researching to possibly re-write the book, torrent?  :P  Yeah, off
line reading gives depth online doesn't offer.

On Sun, Jun 19, 2011 at 10:11 AM, Thomas <twest9@verizon.net> wrote:

>
> As a guy who first read the book around 40 years ago, I can endorse the
> recommendation.
>
> -tom
>
> On Jun 17, 2011, at 9:05 PM, Rob Pike wrote:
>
> > As the guy who literally wrote the book on this, please may I
> > recommend some offline reading?
> >
> > -rob
> >
>
>
>

[-- Attachment #2: Type: text/html, Size: 814 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-07-04  0:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-17 14:55 [9fans] in ed, how to do i do this? Fernan Bolando
2011-06-17 15:04 ` yy
2011-06-17 15:07   ` Fernan Bolando
2011-06-17 15:08     ` John Floren
2011-06-17 15:22     ` Bakul Shah
2011-06-17 15:26       ` Fernan Bolando
2011-06-17 15:27       ` dexen deVries
2011-06-17 16:18       ` Skip Tavakkolian
2011-06-17 16:31         ` dexen deVries
2011-06-17 15:11 ` dexen deVries
2011-06-17 15:17 ` dexen deVries
2011-06-17 22:38   ` Mauricio CA
2011-06-18  1:05     ` Rob Pike
2011-06-19 14:11       ` Thomas
2011-07-04  0:58         ` Josh Marshall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).