<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sed on MarkJacobsen.net</title><link>https://markjacobsen.net/tags/sed/</link><description>Recent content in Sed on MarkJacobsen.net</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sat, 17 Mar 2018 14:26:00 +0000</lastBuildDate><atom:link href="https://markjacobsen.net/tags/sed/index.xml" rel="self" type="application/rss+xml"/><item><title>Using sed to view and replace text on a specific file in Linux</title><link>https://markjacobsen.net/2018/03/using-sed-to-view-and-replace-text-on-a-specific-file-in-linux/</link><pubDate>Sat, 17 Mar 2018 14:26:00 +0000</pubDate><guid>https://markjacobsen.net/2018/03/using-sed-to-view-and-replace-text-on-a-specific-file-in-linux/</guid><description>&lt;p&gt;Ever need to replace very specific text on a particular line in a very large file on Linux? Enter the sed command.&lt;/p&gt;
&lt;p&gt;To view the line (let’s say line 864 in this case) in the specific file, issue this command…&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ sed -n '864'p myfile.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And let’s say you get back the string ” I hate cheese”. Since we all know that’s not true, you can use a different variation of the sed command to replace “hate” with “love” like so…&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ sed -i '864s/hate/love/' myfile.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And if you’re really curious on how this even came about, it was due to an error in the phpMyAdmin export.php script when you had to change “break 2” to “break” on line 846 as identified here: &lt;a href="https://askubuntu.com/questions/928883/500-error-on-phpmyadmin-export-on-phpmyadmin-export-php/930975" target="_blank"&gt;&lt;a class="link" href="https://askubuntu.com/questions/928883/500-error-on-phpmyadmin-export-on-phpmyadmin-export-php/930975" target="_blank" rel="noopener"
 &gt;https://askubuntu.com/questions/928883/500-error-on-phpmyadmin-export-on-phpmyadmin-export-php/930975&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>