我有一个文本文件,我想用awk过滤 。该文本文件看起来像这样:Howto在Bash脚本中将字符串作为参数传递给AWK
foo 1
bar 2
bar 0.3
bar 100
qux 1033
我想用awk在bash脚本中过滤这些文件。
#!/bin/bash
#input file
input=myfile.txt
# I need to pass this as parameter
# cos later I want to make it more general like
# coltype=$1
col1type="foo"
#Filters
awk '$2>0 && $1==$col1type' $input
但不知何故,它失败了。什么是正确的做法?
谢谢你,谢谢yoooou :))......你不知道多少走上找到这样的答案......再次谢谢主席先生 – 2014-08-05 19:48:17