Very quick solution using awk. I know there are other (more pretty) ways, but this may get you started.
cat <filename> | awk '$0 ~ /^.*\t.*\t111.*/' The regular expression matches: <any chars><tab><any chars><tab>"111"<any chars> So it looks for 111 in 3rd column separated by tabs (I included your column with a, b, c in a little test so I had three columns). Frans On Sunday 09 March 2003 20:02, Youichi Mano wrote: > 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? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]