Text processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I've got the following output

Col1    Col2   Col3       Col5
1         000    001        Yes
2         000    001
3         000    001
4         Yes                 Yes
4         000    001
4         000    001
5         000    001
5         Yes    001
6         000    001        Yes

As you can see the column widths vary in size. What I need to do is to
find out The number in Col1 that is associated with all those "Yes"
occurrences in Col5. How can I do this.
I've tried the following
cat file | tr -s ' ' ' ' | tr -s '\t' ' ' | cut -d ' ' -f 6

But I get a result like this

Hi

I've got the following output

Col1 Col2 Col3 Col5
1 000 001 Yes
2 000 001
3 000 001
4 Yes Yes
4 000 001
4 000 001
5 000 001
5 Yes 001
6 000 001 Yes

As you can see one of the "Yes" statements has moved into the third
column, so that's a wrong move.

Any help would be appreciated

Thanks
Dan


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux