【发布时间】:2023-03-21 14:46:01
【问题描述】:
我需要替换只选择的250个erlang文件(扩展名为.erl)的前4个标题行,但是目录+子目录中总共有400个erlang文件,我需要避免修改不需要的文件改变。 我有要修改的文件名列表,但不知道如何让我的 linux 命令使用它们。
sed -i '1s#.*#%% This Source Code Form is subject to the terms of the Mozilla Public#' *.erl
sed -i '2s#.*#%% License, v. 2.0. If a copy of the MPL was not distributed with this file,#' *.erl
sed -i '3s#.*#%% You can obtain one at http://mozilla.org/MPL/2.0/.#' *.erl
sed -i '4s#.*##' *.erl
在上面的命令中,我不是传递*.erl,而是传递那些我需要修改的文件名列表,一一完成需要3天以上的时间。
有什么办法吗?
【问题讨论】:
标签: linux unix sed file-handling