From: Glynn Clements <glynn@gclements.plus.com>
To: "Mário Gamito" <gamito@gmail.com>
Cc: linux-admin@vger.kernel.org
Subject: Re: Changes in file (huge problem)
Date: Sun, 24 Dec 2006 22:23:21 +0000 [thread overview]
Message-ID: <17806.64985.640326.23994@cerise.gclements.plus.com> (raw)
In-Reply-To: <458E85CA.7050802@gmail.com>
Mário Gamito wrote:
> I have this file in the following format:
>
> tarta 16340309 marsanpin brigittamario@xxx.pt
> lms doom123 Luis Miguel Sequeira lms@xxx.pt
> jura teste Juraci jgweb@bol.com.br
> jsilva t00lt0ya5 Jorge Silva jsilva@xxx.com
> tchock mail#4829 tchock engDias@xxx.pt
> reporterx noname Duarte Oliveira mtbf99@xxx.com
> erkulix brunoverab4 Bruno Cruz
>
> First field is a username;
> Second field is a password in clear text;
> *Last field is the email;
> The field between is the name.
>
> As you can see, some lines don't have the name, and names have an unknow
> number of words.
> Some lines don't have the e-mail.
>
> What i need is:
> Substitute spaces for ":", *except* of course the spaces within the name.
#!/usr/bin/sed -f
s/^\([^ ]\+\) \+\([^ ]\+\) \+\(.\+\) \+\([^ @]\+@[^ @]\+\) *$/\1:\2:\3:\4/
s/^\([^ ]\+\) \+\([^ ]\+\) \+\([^ @]\+@[^ @]\+\) *$/\1:\2::\3/
s/^\([^ ]\+\) \+\([^ ]\+\) \+\(.\+\) *$/\1:\2:\3:/
--
Glynn Clements <glynn@gclements.plus.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2006-12-24 22:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-24 13:51 Changes in file (huge problem) Mário Gamito
2006-12-24 22:23 ` Glynn Clements [this message]
2006-12-24 23:31 ` Mário Gamito
2006-12-26 23:48 ` Glynn Clements
2006-12-25 10:25 ` terry white
2006-12-25 19:09 ` Mário Gamito
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=17806.64985.640326.23994@cerise.gclements.plus.com \
--to=glynn@gclements.plus.com \
--cc=gamito@gmail.com \
--cc=linux-admin@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;
as well as URLs for NNTP newsgroup(s).