Search and add the column in the file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Search and add the column in the file
# 1  
Old 03-11-2014
Question Search and add the column in the file

Hi All,

I have the Overview.csv file like below format

Code:
Message ID    Sendout    Group Name    Email    Subject    Name    Type    Rcpts    Responses    Response Rate    Open Rate    Click Rate
2000009723    01-22-2014 16:14    Test_GroupPQA2013    000123@yahoo.com    INFO RISQUE D'INONDATION SUR LES DEPARTEMENTS COTIERS DU NORD OUEST    METEO EMAIL ALERT 2014-01-22 19-45_Employee?s_Customer    normal    5    0    0    100    0
1200826548    10-03-2013 13:16    Test_GroupPQA2013    000@yahoo.com    PQA team wishes    Deepavali Wishes    normal    5    0    0    40    0

Script has to get the Message ID from the overview file and search the files if it matches then open the file and need to copy the respective Name, Subject and Sendout from overview.csv file then paste it in three columns

Send_1200826548.csv

Code:
recipient.MessagePK        user.PK        user.Email        user.CustomAttribute.GUID
1200826548        12047954722        123@gmail.com        opirter435345                        
1200826548        12328947188        0123@kenscio.com                                
1200826548        12340264105        01234@kenscio.com

Out put file like below

Code:
recipient.MessagePK        user.PK        user.Email        user.CustomAttribute.GUID        message.Name        message.Subject        message.SendStartDate
1200826548        12047954722        123@gmail.com        opirter435345                 Deepavali Wishes     PQA team wishes    10-03-2013 13:16         
1200826548        12328947188        0123@kenscio.com                             Deepavali Wishes    PQA team wishes    10-03-2013 13:16                1200826548        12340264105        01234@kenscio.com                         Deepavali Wishes    PQA team wishes    10-03-2013 13:16

File names are like below
Send_1200826548.csv
Send_2000009723.csv

Thanks,
Saravanan

Moderator's Comments:
Mod Comment edit by bakunin: please use CODE-tags, as required by the rules of this forum. Thank you.

Last edited by bakunin; 03-11-2014 at 12:33 PM..
# 2  
Old 03-11-2014
What have you tried so far and what was the problem?

bakunin
# 3  
Old 03-11-2014
Hi Bakunin,

I need script as per my requirement.

Thanks,
Saravanan
# 4  
Old 03-11-2014
Quote:
Originally Posted by armsaran
I need script as per my requirement.
...and i need a lot of money. Like the great philosopher Mick Jagger once said: you can't always get what you want - but if you try, sometime, you just might find you get what you need.

So, again: what have you tried so far and what was the problem in doing so?

bakunin
This User Gave Thanks to bakunin For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Search spaces in 5th column in large file

i have a file having 5 columns with more than million records. And i want to search using UNIX command to find if there are any spaces in 5th column. any please help. (1 Reply)
Discussion started by: sivakumar.p
1 Replies

2. Shell Programming and Scripting

How to search and replace string from nth column from a file?

I wanted to search for a string and replace it with other string from nth column of a file which is comma seperated which I am able to do with below # For Comma seperated file without quotes awk 'BEGIN{OFS=FS=","}$"'"$ColumnNo"'"=="'"$PPK"'"{$"'"$ColumnNo"'"="'"$NPK"'"}{print}' ${FileName} ... (5 Replies)
Discussion started by: Amit Joshi
5 Replies

3. Shell Programming and Scripting

Search substring in a column of file

Hi all, I have 2 files, the first one containing a list of ids and the second one is a master file. I want to search each id from the first file from the 5th col in the second file. The 5th column in master file has values separated by ';', if not a single value is present. Each id must occur... (2 Replies)
Discussion started by: ritakadm
2 Replies

4. Shell Programming and Scripting

File 1 Column 1 value search in File 2 records, then loop?

Summary: I planned on using Awk to grab a value from File 1 and search all records/fields in file 2. If there is a match in File 2, print the first column value of the record of the match of File2. Continue this search until the end of file 2. Once at the end of file 2, grab the next value in... (4 Replies)
Discussion started by: Incog
4 Replies

5. Shell Programming and Scripting

How to search for a word in a particular column of a file

How to search for a word like "computer" in a column (eg: 4th field) of a '***' delimited file and add a column at the end of the record which denotes 'Y' if present and 'N' if not. After this, we need to again check for words like 'Dell' but not 'DellXPS' in 5th field and again add another column... (5 Replies)
Discussion started by: Jassz
5 Replies

6. Shell Programming and Scripting

Search a file column wise and delete it

Scottn, m really sorry but i have not got my answer yet. my concern is how to delete the row !!! i have a file which has a column that is unique i am intending to serach it and if it is there to remove the row. the file looks like ROLLNO,NAME ,SUB1,SUB2,SUB3,TOTAL,PERCENTAGE,RESULT... (9 Replies)
Discussion started by: gotam
9 Replies

7. Shell Programming and Scripting

Search a file column wise and delete it

i have a file which has a column that is unique i am intending to serach it and if it is there to remove the row. the file looks like ROLLNO,NAME ,SUB1,SUB2,SUB3,TOTAL,PERCENTAGE,RESULT 15 ,rig ,34 ,56 ,87 ,177 ,59 % ,PASS 23 ,wel ,45 ,76 ,56 ,177 ,59 % ... (0 Replies)
Discussion started by: gotam
0 Replies

8. UNIX for Dummies Questions & Answers

Search Pattern and add column

Hi, I have two files. file1 contents: aaa bbb ccc ddd eee fff ggg ddd www eee ggg dde qqq zzz hhh ddd file2 contents: mmm mmm mmm mmm Now I want to add file2 contents to end of lines in file1 where a line contains pattern "ddd" and it should look like this: file3 contents: aaa... (3 Replies)
Discussion started by: harjitsingh
3 Replies

9. Shell Programming and Scripting

Search name and display column from a file

Hi I have search everywhere for this but I haven't got any result. so here is my question? I am trying to ask user to enter a name and then searching that name from a file and from a specific column. If user enter something, it should only displaying that name from that specific column and If the... (3 Replies)
Discussion started by: sillyha
3 Replies

10. Shell Programming and Scripting

Search max value in a column in a file instead of sort

Hi Everyone, 1.txt 00:00:00 0 0 0 0 0 0 0 00:00:01 0 0 0 2 1 33 2 00:00:02 5 0 0 0 0 0 0 00:00:03 0 4 0 0 0 0 0... (5 Replies)
Discussion started by: jimmy_y
5 Replies
Login or Register to Ask a Question