愚かな間違った

愚かな間違った

awkを使ってファイルを変更する方法は? ("sed -i"と同じ)

上記の回避策によれば、Macで次のエラーが発生します。 Macで動作しない理由を見つける方法は?

awk -i inplace '/hello/ { print "oh,", $0 }' file
awk: fatal: cannot open source file `inplace' for reading: No such file or directory
$ awk --version
GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.1.0-p13, GNU MP 6.2.1)
Copyright (C) 1989, 1991-2022 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/.

$ brew info gawk
==> gawk: stable 5.2.1 (bottled), HEAD
GNU awk utility
https://www.gnu.org/software/gawk/
Conflicts with:
  awk (because both install an `awk` executable)
/usr/local/Cellar/gawk/5.2.0 (98 files, 5.7MB)
  Poured from bottle on 2022-10-30 at 23:05:46
/usr/local/Cellar/gawk/5.2.1 (98 files, 5.8MB) *
  Poured from bottle on 2022-12-28 at 23:01:26
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gawk.rb
License: GPL-3.0-or-later
==> Dependencies
Required: gettext ✔, mpfr ✔, readline ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 24,742 (30 days), 82,190 (90 days), 178,408 (365 days)
install-on-request: 20,593 (30 days), 67,741 (90 days), 135,672 (365 days)
build-error: 7 (30 days)

ベストアンサー1

おすすめ記事