{"id":1094,"date":"2009-04-19T20:23:44","date_gmt":"2009-04-20T00:23:44","guid":{"rendered":"http:\/\/blogs.sungeek.net\/unixwiz\/?p=1094"},"modified":"2009-04-19T20:23:44","modified_gmt":"2009-04-20T00:23:44","slug":"php-1-perl-sed-0","status":"publish","type":"post","link":"https:\/\/blogs.sungeek.net\/unixwiz\/2009\/04\/19\/php-1-perl-sed-0\/","title":{"rendered":"PHP 1, PERL &#038; SED 0"},"content":{"rendered":"<p>So I have been trying to figure out how to get PERL and SED to replace a set of random characters in a line with a fixed set of characters. I tried for about 2 days on Perl and sed, but could not get it to work right. So last night I tried PHP and got it in one shot. So say I have a file that has a part of a line that looks like this:<\/p>\n<p>Variable1=test&amp;Variable2=test%2312&amp;Variable3=92ns10i9js<\/p>\n<p>and I want to replace what ever is in the Variable2 value to be just a bunch of X&#8217;s or some other fixed value. Nothing I could do in sed and Perl would work, I ended up with this in PHP:<\/p>\n<p>$buffer2=ereg_replace(&#8220;&amp;Variable2=(.*)&amp;Variable3&#8243;,&#8221;&amp;Variable2=XXXXXXXX&amp;Variable3&#8221;,$buffer);<\/p>\n<p>So can any one tell me how to do it in Perl or sed?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I have been trying to figure out how to get PERL and SED to replace a set of random characters in a line with a fixed set of characters. I tried for about 2 days on Perl and sed, but could not get it to work right. So last night I tried PHP and &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blogs.sungeek.net\/unixwiz\/2009\/04\/19\/php-1-perl-sed-0\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PHP 1, PERL &#038; SED 0&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[121,468,123,124,122],"class_list":["post-1094","post","type-post","status-publish","format-standard","hentry","category-php","tag-perl","tag-php","tag-regular-expressions","tag-scripting","tag-sed"],"_links":{"self":[{"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/posts\/1094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/comments?post=1094"}],"version-history":[{"count":5,"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/posts\/1094\/revisions"}],"predecessor-version":[{"id":1099,"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/posts\/1094\/revisions\/1099"}],"wp:attachment":[{"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/media?parent=1094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/categories?post=1094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sungeek.net\/unixwiz\/wp-json\/wp\/v2\/tags?post=1094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}