re: Command line text substitution
re: Command line text substitution
- Subject: re: Command line text substitution
- From: brian mather <email@hidden>
- Date: Fri, 10 Jan 2003 23:56:52 -0500
From Paul Skinner:
>
Ok, I'm trying to use the right tools. What's the right CL tool for
>
replacing a string within a string? perl is an obvious choice. So, how
>
would I replace a given string in another string using do shell script?
>
--
>
Paul Skinner
How about sed?
sed 's/string1/string2/' filename
Perl no doubt would work but I've no experience with it and have used sed to
meet my needs.
You can build a regular expression to find string 1 and then either
completely replace it with string2 or use back references to selectively
keep some parts while replacing others.
Could even build a quick 'for' loop to iterate thru files while using the
shell if that proves more convenient than to do so in your Applescript.
brian
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.