Extracting a certain pattern..

Hi All,

Suppose i have 4 coloumns in a excel sheet.

Col A   Col B    Col C     Col D
123      time1      abc          8
231      time2      xyz          6
324      time3      abc          4
456      time4      xyz          3
132      time5      abc          2

I want the data of coloum A depending upon the col c and col d

if col c is abc and col d >5 ... den col A data would be ... How to extract this by using any of the unix command ....

Thanks in Advance

convert your excel to csv file ( with delimted as , comma )

 
awk -F, 'NR>1{if($3=="abc" && $4>5)$1="XYZ"}1' input.csv

The above code replace the first column value as XYZ ( if the conditions met -- col c is abc and col d >5 )

o/p of col A should be like that ...

id col c =abc and col d >5
then col A produce .. 123

awk '$3=="abc" && $4 > 5 {print $1}' file