[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/07/2009 at 01:10PM PST, ID: 24880859 | Points: 500
[x]
Attachment Details

script to create tilde seperate output file and the count

Asked by yerruhari in Shell Scripting, Scripting Languages, Unix Systems Programming

I have an input file which contains the following data...

sno: 10
id: 15000
firstname: abcd
mail: abcd@mail.com
secondname: efgh
mail: efgh@mail.com

sno: 11
id: 15001
firstname: ijkl
mail: ijkl@mail.com
secondname: mnop
mail: mnop@mail.com

sno: 12
id: 15002
firstname: qrst
mail: qrst@mail.com
secondname:  uvwx
mail: uvwx@mail.com

sno: 13
id: 15003
firstname: mike
secondname: shane
mail: shane@mail.com

sno:14
id: 15004
secondname: donald
mail: donald@mail.com

sno: 15
id: 15001
firstname: abcd
mail: abcd@mail.com
secondname: efgh
mail: efgh@mail.com

sno: 16
id: 15001
firstname: ijkl
mail: ijkl@mail.com
secondname: mnop
mail: mnop@mail.com

sno: 17
id: 15002
firstname: abcd
mail: abcd@mail.com
secondname: efgh
mail: efgh@mail.com

sno: 18
id: 15003
firstname: ijkl
mail: ijkl@mail.com
secondname: mnop
mail: mnop@mail.com

sno: 19
id: 15004
firstname: abcd
mail: abcd@mail.com
secondname: efgh
mail: efgh@mail.com

sno: 20
id: 15006
firstname: ijkl
mail: ijkl@mail.com
secondname: mnop
mail: mnop@mail.com

sno: 21
id: 15004
firstname: abcd
mail: abcd@mail.com
secondname: efgh
mail: efgh@mail.com

sno: 22
id: 15004
firstname: abcd
mail: abcd@mail.com
secondname: efgh
mail: efgh@mail.com


I need an tilde seperated output file as follows....

10~15000~1~abcd~abcd@mail.com~efgh~efgh@mail.com
11~15001~3~ijkl~ijkl@mail.com~mnop~mnop@mail.com
12~15002~2~qrst~qrst@mail.com~uvwx~uvwx@mail.com
13~15003~2~mike~ ~shane~shane@mail.com
14~15004~4~ ~ ~don~don@mail.com
20~15006~1~ijkl~ijkl@mail.com~mnop~mnop@mail.com

Please note: If there is a firstname's mail id missing, as in the case of sno: 13, it should leave a blank space as shown in the output file.

Also in sno: 14 both the firstname and firstname's mail id are missing....so it should leave a blank spaces for both as shown in the output.

I don't have the option of distinguishing the firstname's mail id and secondname's mail id.........since both of them start with xmail:   so if the firstname's mail id is missing there is a chance that it takes second name's mail id in the output file.

Please try to provide me with a unix script for the above. I am using sun solaris. This is just sample data....i have data from sno: 1 to sno: 5000 in my input file. The firstname will be followed by firstname;s mail id and secondi name will be followed by secondname's maild id. Please make sure there will be no problems if there is any missing data like... firstname missing........secondname missing......secondname's mail id missing.....firstname's mail id missing......sno's missing and so on..............it should leave a blank space in the above cases.

Also i should get a count of haw many times the id is repeating as shown in the output file.for example, If the id is repeating 4 times as in the case of 15004. I should get that count and the remaining three entries can be left out. No matter what the other fileds (sno,firstname,mail,secondname,mail) may be. It should be uniqed by the id only and i should get that count.

Please do make it as soon as you can as it is pretty urgent
[+][-]11/07/09 03:06 PM, ID: 25768511

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/07/09 06:29 PM, ID: 25769176

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 06:00 AM, ID: 25770474

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 08:10 AM, ID: 25770852

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 08:24 AM, ID: 25770892

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 08:51 AM, ID: 25770970

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 09:10 AM, ID: 25771017

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 09:16 AM, ID: 25771039

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 09:19 AM, ID: 25771050

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 09:27 AM, ID: 25771080

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 09:28 AM, ID: 25771085

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 09:34 AM, ID: 25771113

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 09:35 AM, ID: 25771118

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 09:37 AM, ID: 25771127

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 09:48 AM, ID: 25771169

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 09:50 AM, ID: 25771179

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 09:54 AM, ID: 25771191

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 09:58 AM, ID: 25771202

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 10:00 AM, ID: 25771206

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 10:02 AM, ID: 25771209

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 10:03 AM, ID: 25771217

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 10:08 AM, ID: 25771229

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 10:19 AM, ID: 25771269

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 10:34 AM, ID: 25771314

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 10:42 AM, ID: 25771341

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 10:59 AM, ID: 25771424

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 11:13 AM, ID: 25771470

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 11:25 AM, ID: 25771506

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 11:36 AM, ID: 25771555

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 11:37 AM, ID: 25771559

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 11:43 AM, ID: 25771586

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 12:21 PM, ID: 25771718

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 12:45 PM, ID: 25771795

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 12:53 PM, ID: 25771835

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/09 01:27 AM, ID: 25783720

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/09 07:17 PM, ID: 25792080

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/09 07:20 PM, ID: 25792090

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/09 07:56 PM, ID: 25792203

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/09 11:37 PM, ID: 25792964

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/11/09 12:15 AM, ID: 25793101

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_3_20080625