我用的是Debian 8.2。到目前为止,这里是test.sh。
#!/bin/bash
wget http://winhelp2002.mvps.org/hosts.txt -O fileA
tail -n +26 fileA >> fileB我希望fileA内容的第26行从第26行开始,替换fileB中的所有内容--因此,最后输出的前25行来自原始fileB的第1-25行,其余的是fileA的第26行。
我该怎么做?
发布于 2015-12-22 05:10:49
#!/bin/bash
wget http://winhelp2002.mvps.org/hosts.txt -O fileA
head -25 fileB > tempfile && mv tempfile fileB
tail -n +26 fileA >> fileBhead -25将从fileB中取出前25行,并将其转储到tempfile中。然后将tempfile重命名为fileB。
https://stackoverflow.com/questions/34408644
复制相似问题