Re: Changes in file (huge problem)
Mário Gamito <[email protected]>
| Newsgroups | org.kernel.vger.linux-admin |
|---|---|
| Message-ID | <[email protected]> |
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ário Gamito Glynn Clements wrote: > Mário Gamito wrote: > >> I have this file in the following format: >> >> tarta 16340309 marsanpin [email protected] >> lms doom123 Luis Miguel Sequeira [email protected] >> jura teste Juraci [email protected] >> jsilva t00lt0ya5 Jorge Silva [email protected] >> tchock mail#4829 tchock [email protected] >> reporterx noname Duarte Oliveira [email protected] >> 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:/ > - To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html