看板 Linux 關於我們 聯絡資訊
太多行不好推文, 原諒我用回文浪費一下版面. 我用 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$ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.222.17.107 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1427483244.A.6EE.html
mshockwave: 因為Mac是BSD系的? 03/28 17:01
rickieyang: 原 po 說他用 Mac, 我才特地開 Mac 試的呀. 03/28 21:54
kenduest: mac 也有 bash/csh/tcsh 等等,行為應該結果一樣 03/28 22:00