Awk

awk 無需手動輸入

  • September 7, 2020

跑步是怎麼來man awkNo manual entry for awk?坦率地說,我從來沒有在我的 Archlinux 系統上親自安裝過 Awk,但我剛剛發現在目前的,我最後安裝的,沒有man awk,這很奇怪。man gawk另一方面,工作正常。

有什麼線索嗎?

這是版本以及其他可能相關的輸出:

$ awk --version 
GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.0)
Copyright (C) 1989, 1991-2020 Free Software Foundation.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

$ which awk
/usr/bin/awk

$ ls -l $(which awk)
lrwxrwxrwx 1 root root 4 Apr 15 07:38 /usr/bin/awk -> gawk

$ which gawk
/usr/bin/gawk

man man,手冊頁通常儲存在/usr/share/man.

由於 Awk 有幾個實現(gawk, mawk, …),它通常是一個符號連結,指向要使用的真正 Awk,在你的情況下,是 GNU awk。它的聯機幫助頁也是如此:

$ readlink /usr/share/man/man1/awk.1.gz
/etc/alternatives/awk.1.gz
$ readlink /etc/alternatives/awk.1.gz
/usr/share/man/man1/gawk.1.gz

檢查您是否可以在/usr/share/man.

find /usr/share/man/man1 -path '*/awk*'
  • 如果是,它可能是一個損壞的連結,在這種情況下,您可以刪除它並創建一個指向所需手冊頁的連結(見下文)。
  • 如果沒有,則連結失去。不知何故你刪除了它或它沒有發貨。這可能可以通過再次安裝軟體包來解決。否則,手動創建符號連結:
ln -s /usr/share/man/man1/gawk.1.gz /usr/share/man/man1/awk.1.gz

引用自:https://unix.stackexchange.com/questions/608152