How would I do this with something like sed?

In my case I am attempting to create a new file from the /etc/group file.
What I want to do is generate a list of all the users in a particular group
which I can then modify and create an address book file for my webmail
application.

The group I am looking at is called "email" and I use cut and grep to paste
the email group into a new file. Ofcourse though it goes into the new file
as below all on one line:

email: persona personb personc etc

What I really want to do is turn this file into a list such as:

persona
personb
personc

This way down the track it is easier to manipulate. With you CTRL V, CTRL M
tip in VI it works beautifully by replacing all spaces with a ^M (:g/
/s//^M/g), thanks.

So my question is if I want to do this via an automatic script what do I use
and how? Can sed do it? or awk?

Thanks in advance for all help.

Regards,

Les Stott
Systems Administrator
Rentokil Initial
[EMAIL PROTECTED]
(02) 9370 9348


This email is confidential. If you are not the intended recipient, you must
not disclose
or use the information contained in it. If you have received this in error,
please
advise the sender by return email and delete the material from your
computer.

Rentokil Initial Pty Ltd ABN 98 000 034 597 does not warrant that any
attachments are free from viruses or any other defects. You assume all
liability for any loss, damage or other consequences which may arise from
opening or using the attachments.
----- Original Message -----
From: Michael Covi <[EMAIL PROTECTED]>
To: Andre Pang <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 11:48 PM
Subject: Re: [SLUG] How to type ^M


> Thanks! Excellent! :)
>
> Doing it by hand with vi, as i ended up having to do, went against all
good
> principles! :)
>
> On Mon, 12 Nov 2001 23:37, Andre Pang wrote:
> > On Mon, Nov 12, 2001 at 11:30:47PM +1100, Michael Covi wrote:
> > > Does anyone know how to type ^M so it appears as the actual control
> > > character? I was stuck trying to convert some scripts from dos to unix
> > > format on a very small root filesystem. It did have sed but how the
hell
> > > do you type in the character to match it and eliminate it?
> >
> > Press Ctrl-V Ctrl-M (or Ctrl-V Enter -- Ctrl-M is basically the
> > same as the Enter key).
> >
> > Ctrl-V 'quotes' the next character and forces the shell to
> > interpret it literally.  This works in most shells and in Vi.
> >
> > If you're using Emacs, the quote key is Ctrl-Q instead of Ctrl-V
> > (so it's Ctrl-Q Ctrl-M).  In joe, it's ` (backtick).
>
> --
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://lists.slug.org.au/listinfo/slug
>


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to