Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我sed可以这样做:
sed
#!/bin/sed -f s/pattern/replacement/g
perl 中上述最简单的等价物是什么?
#!/usr/bin/env perl while (my $m = <>) { $m =~ s/pattern/replacement/g; print $m; }
在 perl 中它只是
#!/usr/bin/perl -nw s/pattern/replacement/g
这将是 :
my $str = "fred"; $str =~ s/f/g/g;