From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?M=E1rio_Gamito?= Subject: Re: Changes in file (huge problem) Date: Sun, 24 Dec 2006 23:31:24 +0000 Message-ID: <458F0DCC.3040009@gmail.com> References: <458E85CA.7050802@gmail.com> <17806.64985.640326.23994@cerise.gclements.plus.com> Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <17806.64985.640326.23994@cerise.gclements.plus.com> Sender: linux-admin-owner@vger.kernel.org List-Id: Content-Type: text/plain; charset="iso-8859-1"; format="flowed" To: Glynn Clements Cc: linux-admin@vger.kernel.org Hi Glynn, Thank you so much for your answer. I've used your code in a script and run: # cat passwords.sql | your_script but all i get is a file named typescrypt with this content: Script started on Sun Dec 24 23:24:28 2006 What am i doing wrong ? Warm Regards, M=E1rio Gamito Glynn Clements wrote: > M=E1rio Gamito wrote: >=20 >> 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 un= know=20 >> number of words. >> Some lines don't have the e-mail. >> >> What i need is: >=20 >> Substitute spaces for ":", *except* of course the spaces within the = name. >=20 > #!/usr/bin/sed -f > s/^\([^ ]\+\) \+\([^ ]\+\) \+\(.\+\) \+\([^ @]\+@[^ @]\+\) *$/\1:\2:\= 3:\4/ > s/^\([^ ]\+\) \+\([^ ]\+\) \+\([^ @]\+@[^ @]\+\) *$/\1:\2::\3/ > s/^\([^ ]\+\) \+\([^ ]\+\) \+\(.\+\) *$/\1:\2:\3:/ >=20 - 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