Mass Changes

T

Toby A Inkster

Toby said:
#!/usr/bin/perl
$a = shift @ARGV;
system("sed -i 's/" . shift @ARGV . '/' . shift @ARGV . "/g' $a");

Dammit! That'll teach me not to test my scripts before posting! Order of
precendence...

#!/usr/bin/perl
$a = shift @ARGV;
system("sed -i 's/" . (shift @ARGV) . '/' . (shift @ARGV) . "/g' $a");

And here's a shorter one...

#!/usr/bin/perl
system("sed -i 's/".$ARGV[++$a].'/'.$ARGV[++$a]."/g' ".$ARGV[$b]);
 
M

Matt Probert

Is two lines (excluding shebang) too many? I can do it in one if I'm
allowed to change the order of the arguments to STRING, REPLACEMENT,
FILESPEC.

#!/usr/bin/perl
$a = shift @ARGV;
system("sed -i 's/" . shift @ARGV . '/' . shift @ARGV . "/g' $a");

(Very dirty. Won't work for some STRINGs -- anything that has a special
meaning in a regexp.)

Will that work under Windows? Looks to me like it's calling an
external program - 'sed'.

Matt
 
C

Charles Sweeney

Matt Probert said:
Touche!

I always think (well sometimes) that "its" should have an
apostrophe...I know, I know...

Me too, because you were talking about the richness belonging to "it". So
it should be "it's" richness!

I had "it's" (in the possessive sense we are discussing here) on a website.
Some stuffy guy emailed to point it out, which I then changed. It happens!
 
M

Matt Probert

Me too, because you were talking about the richness belonging to "it". So
it should be "it's" richness!

That's exactly my argument. I'm not a linguist, I don't trace the
roots of words to argue their correctness, I'm a writer.

Matt
 
M

Mark Parnell

Me too, because you were talking about the richness belonging to "it". So
it should be "it's" richness!

What can I say? English is a stupid language. :)
I had "it's" (in the possessive sense we are discussing here) on a website.
Some stuffy guy emailed to point it out, which I then changed. It happens!

I'd be the stuffy guy who'd notice it, and laugh about it with his
friends, although I wouldn't email you about it. *sigh* I'm such a nerd.
 
B

Brian

Matt said:
I always think (well sometimes) that "its" should have an
apostrophe...

Why? No other possessive pronoun does:
his, hers, ours, its

By contrast, contractions always use an apostrophe:
didn't, won't, shouldn't, it's
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,794
Messages
2,569,641
Members
45,353
Latest member
RogerDoger

Latest Threads

Top