Pls help with what (should be) a simple substitution exp?
6 views
Skip to first unread message
BobMCT
unread,
Apr 1, 2013, 2:51:02 PM4/1/13
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I'm trying to create a simple sed script that will perform the
following on the source files I pass to it:
I'm converting a zillion older but functional programs (perl & php)
where the original author did not enclose operators such as = with
spaces. I'm trying to create a substitution that does that.
If the statment looks like: $field1=$field2;
it will end up looking like: $field1 = $field2;
Of course there are numerous exceptions but I've started with
something like this:
# sed file to insert spaces around equal sign(s)
s/[a-zA-Z0-9\]]/$1\ \=\ /g
s/\=[a-zA-Z0-9\]]/\= \$1/g
And I'm having trouble with the parameter phrasing (i.e.: referencing
what led up to the match and also what may follow the match.
I've looked through my O'Reilly books on the subject and searched
reasonsly well on the web but this must be more specific than I can
find.
Can someone please advise as to how I can modify this to funtion as
expected?