Filter data in Excel sheet using Shell Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filter data in Excel sheet using Shell Script
# 1  
Old 12-09-2009
Filter data in Excel sheet using Shell Script

Hi,

I have an excel sheet which has 100000 records. All these records are having 3 columns each with the last column as "Y" or "N". I would like to filter those records which has the value "Y". Can you please let me know how to proceed with that?

Thanks in advance.

-Sri

---------- Post updated at 11:39 AM ---------- Previous update was at 11:09 AM ----------

Any update on this
# 2  
Old 12-09-2009
If it is a CSV file, try

Code:
awk -F, '/Y$/'  < file.csv

# 3  
Old 12-09-2009
Hi ,

Thank you for the reply. Here is how it goes.

1. I extract the details from database
2. Put it in a text file. I separate 3 fields by "|" (Pipe) in the text file.
3. I will convert this text file to an excel sheet. The excel sheet will have 3 columns. In the last column i have "Y" or "N".

Now I want only "Y" in my excel sheet. All "N" from the excel should be filtered. Where can it be done? Can I filter it after converting the text file to excel? Or I have to do it before converting the text file to excel?

Thanks in advance.
# 4  
Old 12-09-2009
Quote:
Originally Posted by bhanusri83
Hi ,

Thank you for the reply. Here is how it goes.

1. I extract the details from database
2. Put it in a text file. I separate 3 fields by "|" (Pipe) in the text file.
3. I will convert this text file to an excel sheet. The excel sheet will have 3 columns. In the last column i have "Y" or "N".

Now I want only "Y" in my excel sheet. All "N" from the excel should be filtered. Where can it be done? Can I filter it after converting the text file to excel? Or I have to do it before converting the text file to excel?

Thanks in advance.
Try:
Step 1:

Code:
awk -F| '/Y$/'  < file.txt

Step 2
Convert back to excel sheet, with delimitter |
# 5  
Old 12-09-2009
Thank you for the reply.

So, you mean to say, extract the details from DB, put in text file, give the "awk" command,then convert it to excel file. Correct?

- Sri
# 6  
Old 12-14-2009
Any solution for the above problem? Any guesses?
# 7  
Old 12-14-2009
What problem? If the advice given did not work, in what way did it not work?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Summing up the data from different excel sheet into one excel sheet

Hi Folks, Can you please advise for any script in unix such that for example , i have 3 different excel sheet at the location /ppt/gfr/exc so the name s of the excel sheet are 1excel.xslx 2excel.xslx 3excel.xslx now in these 3 different excel sheet there is lot of data for example each... (3 Replies)
Discussion started by: punpun66
3 Replies

2. Shell Programming and Scripting

Shell Script for copying text file to Excel Sheet

Hi, I want to write a program to copy a log file to Excel sheet. Excel sheet has four columns MethodName , Code , Description, Details and Time. I want to pick these info from text file and put it in excel sheet. here is how the text file looks - 04.17.2014 08:06:12,697... (1 Reply)
Discussion started by: hershey
1 Replies

3. Shell Programming and Scripting

Adding tab to excel sheet with shell script

(1 Reply)
Discussion started by: sagar_1986
1 Replies

4. Shell Programming and Scripting

Save log data in excel sheet

Hello, I have the following data format in a log file : a : x1 b : x2 c : x3 d : x4 -------- a : x5 b : x6 c : x7 d : x8 so the same fields ( a ,b ,c,d) repeated many times in the same log file but with different "x" values (x5,x6,x7,x8). I need a script to save this data in an... (6 Replies)
Discussion started by: mm00123
6 Replies

5. UNIX for Dummies Questions & Answers

Load UNIX data into excel sheet

Hi, i have some data in a temporary file in Unix (the data is taken from the result of an SQL query). Now i want to dump that data into an excel sheet. How to do that. Someone please advise. Thanks Regards, Vinit (3 Replies)
Discussion started by: vinit raj
3 Replies

6. Shell Programming and Scripting

Export data from database in Excel sheet with the help of Shell script and automated the report

Export data from database in Excel sheet with the help of Shell script and automated the report every day in the mornig. (1 Reply)
Discussion started by: neeraj617
1 Replies

7. Shell Programming and Scripting

a shell script to generate an excel sheet from a text file..

hi, i have a text file that looks like this! i want to generate an excel sheet out of it, removing all the junk data except the addresses that look like . Arrow Electrical Services Rotating Machinery, Electrical Contracting & Mining Specialists Onsite maintenance, breakdown... (8 Replies)
Discussion started by: vemkiran
8 Replies

8. Shell Programming and Scripting

Problem in formatting output of SQL query in excel sheet in shell script

Hi Guys.. Need your help to format the output of my shell script. I am using spool command to take out put in csv file. below is my code. (for example) col USERNAME for a15 col EMAIL for a30 col FULL_NAME for a20 col LAST_LOGIN for a40 col DATE_CREATED for a40 SPOOL 120.csv... (3 Replies)
Discussion started by: Agupte
3 Replies

9. Shell Programming and Scripting

How to update existing excel sheet using shell script

Hi All, I am having an excel sheet with pre-defined format which our business team specified, what i need to do is i have to write a script which need to pick values from database and update specified cells in excel sheet.. can any one please help me in this regard.. I am able to pull the... (3 Replies)
Discussion started by: balanarendra
3 Replies

10. UNIX for Advanced & Expert Users

how to read the data from an excel sheet and use those data as variable in the unix c

I have 3 columns in an excel sheet. c1 c2 c3 EIP_ACCOUNT SMALL_TS_01 select A.* from acc; All the above 3 col shoud be passed a variable in the unix code. 1.How to read an excel file 2.How to pass these data as variable to the unic script (1 Reply)
Discussion started by: Anne Grace
1 Replies
Login or Register to Ask a Question