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

about matrix text editing



Hi all,

I want to extract the lines of which the specified column is matched
by command line programs(grep,cut,wc,...) not any script file.

For example, there is tab separated matrix text like the following.
and I want to extract of which the value of column number 2 is "111".
------------------------
a	1957	111
b	1902	222
c	2001	111
------------------------

i.e. the output will be
----------------
a	1957	111
c	2001	111
----------------

Such a editing is easy in perl script but I cannot easily do that
in command line. 
    grep -P "^.+?\t.+?\t111\n" 1.txt
is confused and very very slow and not smart.

I wonder if I could use "grep" together "cut" command.

Is there any idea?

-- 
Youichi Mano <manoyouichi@hotmail.com>




Reply to: