Re: Text processing

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

 



Hi,

if I get you right, you want to get all lines where in col5 is filled
with yes? Why not just grep for such lines? As your data is not complete
or so, the result of

grep -E "Yes$"

shoudl be a good start. It results in

1         000    001        Yes
4         Yes                 Yes
6         000    001        Yes

And this can be further stripped to get only the numbers. But this won't
filter Lines where a Yes occurs in column 2 or so as the last entry in
the line. But this is a problem of the input data.

Best regards,
Oliver

On Fri, Feb 03, 2006 at 03:50:27PM +0000, Dan Track wrote:
> 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
> 
> -- 
> fedora-list mailing list
> fedora-list@xxxxxxxxxx
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

-- 
Oliver Andrich --- oliver.andrich@xxxxxxxxx --- http://roughbook.de/


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

  Powered by Linux