LoginSignup
1
1

More than 5 years have passed since last update.

shellスクリプト変数をawkに渡す

Last updated at Posted at 2015-09-03

ググったらいろいろやり方でてきたけどこれが一番使いやすかった

やりかた

変数を使用する箇所で、シングルクォートを使ってawk文を分割すればよい

shell
hoge=100
cat ~/tmp.txt |awk '{if ('${hoge}'  <= $1) {print $0}}'

参考

shellスクリプトから呼ぶawkでシェル変数を使う

1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1