Re: about matrix text editing

2003-03-10 Thread Joey Hess
Youichi Mano wrote: > The default character of delimiter seems to be space, so > this does not work well. The default delimiter is \s+, any amount of any whitespace. -- see shy jo pgp0.pgp Description: PGP signature

Re: about matrix text editing

2003-03-09 Thread Youichi Mano
dear Alan Shutko > awk -F'\t' '($3 == 111)' < 1.txt This is the shortest for now. I am not good at awk than perl but I'll usually use this. -- Youichi Mano <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTE

Re: about matrix text editing

2003-03-09 Thread Youichi Mano
dear Joey Hess, Thank you. > > perl -ne 'print if (split)[2]==111' > The default character of delimiter seems to be space, so this does not work well. Instead, I write perl -ne 'print if (split(/\t/))[2]==111' Then, it worked well. regards, -- Youichi Mano <[EMAIL PROTECTED]> -- T

Re: about matrix text editing

2003-03-09 Thread Joey Hess
Youichi Mano wrote: > > perl -nle 'my @cols = split /\t/; print if $cols[2] eq "111"' > > Oh, you are one liner. > This sentence is a little long but I am used to perl so > it is relatively easy. perl -ne 'print if (split)[2]==111' awk does beat shortest possible perl here though. -- #!/usr

Re: about matrix text editing

2003-03-09 Thread Alan Shutko
Frans Pop <[EMAIL PROTECTED]> writes: > cat | awk '$0 ~ /^.*\t.*\t111.*/' Gack! That's no better than the grep version! awk -F'\t' '($3 == 111)' < 1.txt -- Alan Shutko <[EMAIL PROTECTED]> - I am the rocks. Looking for a developer in St. Louis? http://web.springies.com/~ats/ -- To UNSUBSCR

Re: about matrix text editing

2003-03-09 Thread Youichi Mano
dear Colin Watson. > > Sure you can. Use perl's -e option. > > perl -nle 'my @cols = split /\t/; print if $cols[2] eq "111"' Oh, you are one liner. This sentence is a little long but I am used to perl so it is relatively easy. -- Youichi Mano <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, ema

Re: about matrix text editing

2003-03-09 Thread Frans Pop
Very quick solution using awk. I know there are other (more pretty) ways, but this may get you started. cat | awk '$0 ~ /^.*\t.*\t111.*/' The regular expression matches: "111" 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

Re: about matrix text editing

2003-03-09 Thread sean finney
On Mon, Mar 10, 2003 at 04:02:47AM +0900, Youichi Mano wrote: > > a 1957111 > b 1902222 > c 2001111 > > > i.e. the output will be > > a 1957111 > c 2001111 > grep -E '^[a-z]

Re: about matrix text editing

2003-03-09 Thread Colin Watson
On Mon, Mar 10, 2003 at 04:02:47AM +0900, Youichi Mano wrote: > 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 w

about matrix text editing

2003-03-09 Thread Youichi Mano
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". --