| Chris F.A. Johnson 2006-07-21, 6:56 pm |
| On 2006-07-21, kamal.pdoc@gmail.com wrote:
> I need to check if in a line of many columns if column 9 has values
> like 2.10, 2.30 etc. and if yes then print them in a file. I tried the
> following (and some other commands) for a source file like "pure_tf.tr"
>
> cat pure_tf.tr | grep "^r" | grep "1 0 exp" | awk '{ if ($9==/2./)
> print}'
>
> But it doesn't seem to work. My problem is to figure out how to compare
> decimal numbers..?? Please advice. (Mean while I continue to look)
grep "^r.*1 0 exp" pure_tf.tr | awk '$9 ~ /^2\.[0-9]*$/ { print $0 }'
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
|