我正在尝试交换 apache dir.conf 文件中的一些元素,如下所示:
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
我想交换,index.html因为index.php这是所需的输出:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
这是我到目前为止的命令,但我确信有一种更简洁的方法来编写它:
sed -e '2s/\(.*\)\s\(.*\)\s\(.*\)\s\(.*\)\s\(.*\)\s\(.*\)\s\(.*\)\s\(.*\)/\1 \2 \6 \3 \4 \5 \7 \8/'
顺便说一句,我留下了“2s ...”,因为我只想修改文件的第二行。