{"id":636,"date":"2007-03-28T08:46:00","date_gmt":"2007-03-28T14:46:00","guid":{"rendered":"http:\/\/www.cls-solutions.com\/blog\/?p=636"},"modified":"2007-03-28T08:46:00","modified_gmt":"2007-03-28T14:46:00","slug":"sed-one-liners","status":"publish","type":"post","link":"http:\/\/www.cls-solutions.com\/blog\/sed-one-liners\/","title":{"rendered":"SED &#8211; one liners"},"content":{"rendered":"<p>sed G<br \/> sed &#8216;s\/.$\/\/&#8217;               # assumes that all lines end with CR\/LF<br \/> sed &#8216;s\/^M$\/\/&#8217;              # in bash\/tcsh, press Ctrl-V then Ctrl-M<br \/> sed &#8216;s\/\\x0D$\/\/&#8217;            # gsed 3.02.80, but top script is easier<br \/> sed &#8220;s\/\\r\/\/&#8221; infile >outfile         # UnxUtils sed v4.0.7 or higher<br \/> sed &#8216;s\/^[ \\t]*\/\/&#8217;                    # see note on &#8216;\\t&#8217; at end of file<br \/> sed &#8216;s\/foo\/bar\/&#8217;             # replaces only 1st instance in a line<br \/> sed &#8216;s\/foo\/bar\/4&#8217;            # replaces only 4th instance in a line<br \/> sed &#8216;s\/foo\/bar\/g&#8217;            # replaces ALL instances in a line<br \/> sed &#8216;s\/\\(.*\\)foo\\(.*foo\\)\/\\1bar\\2\/&#8217; # replace the next-to-last case<br \/> sed &#8216;s\/\\(.*\\)foo\/\\1bar\/&#8217;            # replace only the last case<br \/> sed &#8216;\/baz\/s\/foo\/bar\/g&#8217; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>sed G sed &#8216;s\/.$\/\/&#8217; # assumes that all lines end with CR\/LF sed &#8216;s\/^M$\/\/&#8217; # in bash\/tcsh, press Ctrl-V then Ctrl-M sed &#8216;s\/\\x0D$\/\/&#8217; # gsed 3.02.80, but top script is easier sed &#8220;s\/\\r\/\/&#8221; infile >outfile # UnxUtils sed v4.0.7 or higher sed &#8216;s\/^[ \\t]*\/\/&#8217; # see note on &#8216;\\t&#8217; at end of file sed &#8216;s\/foo\/bar\/&#8217; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-636","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/posts\/636","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/comments?post=636"}],"version-history":[{"count":0,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/posts\/636\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/media?parent=636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/categories?post=636"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cls-solutions.com\/blog\/wp-json\/wp\/v2\/tags?post=636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}