Re: [问题]awk与csh 搭配传入外部变量的问题

楼主: rickieyang (Rickie Yang)   2015-03-28 03:07:21
太多行不好推文, 原谅我用回文浪费一下版面.
我用 Mac (10.10.2) 试, 结果是你要的耶.
这中间肯定有什么误会...
Area51-MBP:0 rickie$ cat 1.txt
3-6 aaaa.tif
4 bbbb.tif
9-7 cccc.tif
Area51-MBP:0 rickie$ cat 2.txt
1
2
3-6
4
5-0
9-7
Area51-MBP:0 rickie$ cat test.sh
#!/bin/csh
foreach a(`cat 2.txt`)
awk '{if ($1==a) print $0}' a=$a 1.txt
end
Area51-MBP:0 rickie$ ./test.sh
3-6 aaaa.tif
4 bbbb.tif
9-7 cccc.tif
Area51-MBP:0 rickie$
作者: mshockwave (夏克维夫)   2015-03-28 17:01:00
因为Mac是BSD系的?
楼主: rickieyang (Rickie Yang)   2015-03-28 21:54:00
原 po 说他用 Mac, 我才特地开 Mac 试的呀.
作者: kenduest (小州)   2015-03-28 22:00:00
mac 也有 bash/csh/tcsh 等等,行为应该结果一样

Links booklink

Contact Us: admin [ a t ] ucptt.com