[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.

Question
[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: 25768511Expert Comment

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: 25769176Author Comment

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: 25770474Expert Comment

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: 25770852Author Comment

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: 25770892Expert Comment

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: 25770970Author Comment

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: 25771017Expert Comment

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: 25771039Author Comment

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: 25771050Expert Comment

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: 25771080Author Comment

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: 25771085Expert Comment

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: 25771113Author Comment

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: 25771118Expert Comment

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: 25771127Expert Comment

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: 25771169Author Comment

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: 25771179Author Comment

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: 25771191Expert Comment

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: 25771202Expert Comment

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: 25771206Author Comment

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: 25771209Author Comment

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: 25771217Expert Comment

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: 25771229Author Comment

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: 25771269Expert Comment

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: 25771314Author Comment

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: 25771341Expert Comment

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: 25771424Author Comment

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: 25771470Expert Comment

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: 25771506Author Comment

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: 25771555Author Comment

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: 25771559Expert Comment

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: 25771586Expert Comment

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: 25771718Expert Comment

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: 25771795Author Comment

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: 25771835Author Comment

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: 25783720Expert Comment

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: 25792080Author Comment

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: 25792090Author Comment

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: 25792203Expert Comment

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: 25792964Author Comment

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: 25793101Expert Comment

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-89 - Hierarchy / EE_QW_3_20080625