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

If it is a CSV file, try

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

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:

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

Step 2
Convert back to excel sheet, with delimitter |

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

Any solution for the above problem? Any guesses?

What problem? If the advice given did not work, in what way did it not work?

grep "Y$" urfile

Hi Thank you for the reply..It worked using "awk"