且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

替换文本文件模式

更新时间:2023-02-23 14:09:22

我将使用Perl,因为我知道的语法,而无需看它,但它会在AWK非常相似或sed的,因为tekknolagi说:

I'll use Perl, because I know the syntax without having to look it up, but it would be very similar in awk or sed, as tekknolagi says:

perl -pi -e 's|http://site.com/.*([^/]+)"/>|web/$1"/>|;'  <filename>

这将美元最后夹住的p $ pserve一切/和

This will preserve everything between the last / and the "