<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>a.muse: Tag sed</title>
    <link>http://www.jessirae.com/blog/articles/tag/sed</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>One liners for linux, ruby and perl</title>
      <description>My &amp;#8220;go to&amp;#8221; sites for one-liners&amp;#8230;
	&lt;ol&gt;
	&lt;li&gt; &lt;a href="http://www.student.northpark.edu/pemente/sed/sed1line.txt"&gt;&lt;span class="caps"&gt;HANDY ONE&lt;/span&gt;-LINERS &lt;span class="caps"&gt;FOR SED&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt; &lt;a href="http://www.fepus.net/ruby1line.txt"&gt;&lt;span class="caps"&gt;HANDY ONE&lt;/span&gt;-LINERS &lt;span class="caps"&gt;FOR RUBY&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt; &lt;a href="http://www.opentechsupport.net/forums/archive/topic/20438-1.html"&gt;Linux Shell One-Liners&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt; &lt;a href="http://www-128.ibm.com/developerworks/aix/library/au-textedit.html"&gt;Save time with text editing one-liners: Fast editing examples using cat, ed, and sed&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt; &lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-p101/"&gt;One-liners 101: Perl as a command-line utility&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.jessirae.com/blog/pages/scripts"&gt;The one-liners I use the most&lt;/a&gt;&lt;/li&gt;
	&lt;/ol&gt;
</description>
      <pubDate>Mon, 05 Feb 2007 19:53:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:8f05f43a-7b04-4c78-8edc-04adec531e40</guid>
      <author>Jessica</author>
      <link>http://www.jessirae.com/blog/articles/2007/02/05/one-liners-for-linux-ruby-and-perl</link>
      <category>technology</category>
      <category>liner</category>
      <category>one</category>
      <category>ed</category>
      <category>cat</category>
      <category>linux</category>
      <category>perl</category>
      <category>ruby</category>
      <category>sed</category>
      <trackback:ping>http://www.jessirae.com/blog/articles/trackback/8661</trackback:ping>
    </item>
    <item>
      <title>One-liners</title>
      <description>&lt;p&gt;and Frequently used commands I can&amp;#8217;t seem to remember the exact syntax of.  Nothin&amp;#8217; fancy.
&lt;br /&gt;&lt;br /&gt;
&lt;strong&gt;Linux&lt;/strong&gt;
&lt;br /&gt;
&lt;code&gt;find . -name \*.* | xargs grep search_string&lt;/code&gt;&lt;/p&gt;


&lt;ul&gt;&lt;em&gt;navigate to folder you would like to search, enter this command with the search string you would like to find and this command lists all files containing that string&lt;/em&gt;&lt;/ul&gt;

&lt;code&gt;ps x -Ho pid,args&lt;/code&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;em&gt;lists all of the processes running&lt;/em&gt;&lt;/ul&gt;

&lt;code&gt;find / -name gcc&lt;/code&gt;&lt;br /&gt;
&lt;ul&gt;&lt;em&gt;finds all folders named gcc&lt;/em&gt;&lt;/ul&gt;

&lt;code&gt;
sed '/$/,/' /home/Desktop/jessirae &amp;gt; /home/Desktop/jessirae2
&lt;/code&gt;
&lt;ul&gt;&lt;em&gt;places a comma at the end of each line&lt;/em&gt;&lt;/ul&gt;
&lt;code&gt;
paste -sd '\0' - /home/Desktop/jessirae2 &amp;gt; /home/Desktop/jessirae3
&lt;/code&gt;
&lt;ul&gt;&lt;em&gt;The &lt;span class="caps"&gt;NEWLINE&lt;/span&gt; character of every line except the last line in each input file will be replaced with a separator&lt;/em&gt;&lt;/ul&gt;

	&lt;p&gt;&lt;strong&gt;Ruby&lt;/strong&gt;&lt;/p&gt;


&lt;code&gt;"&amp;lt;a href=\"http://www.oldurl.com\"&amp;gt;JessiRae.com&amp;lt;/a&amp;gt;".

gsub(/(http?:\/{2})\S+\.(\w+)(\S+)/,"http://www.jessirae.com/blog/")
&lt;/code&gt;&lt;br /&gt;
&lt;ul&gt;&lt;em&gt;global substitution replaces all instances of some expression in a string with some other string or performs some function on that string&lt;/em&gt;&lt;/ul&gt;

&lt;code&gt;
require 'open-uri'
....
open(url) {

      |page| page_content = page.read()

      page_content

    }

&lt;/code&gt;
&lt;ul&gt;&lt;em&gt;returns html from specified webpage&lt;/em&gt;&lt;/ul&gt;
</description>
      <pubDate>Sat, 06 Jan 2007 22:18:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:36d60141-af63-4c88-b93e-16687b804244</guid>
      <author>Jessica</author>
      <link>http://www.jessirae.com/blog/articles/2007/01/06/one-liners</link>
      <category>technology</category>
      <category>ruby &amp; rails</category>
      <category>gsub</category>
      <category>sed</category>
      <category>find</category>
      <category>paste</category>
      <category>string</category>
      <category>ruby</category>
      <category>commands</category>
      <category>linux</category>
      <trackback:ping>http://www.jessirae.com/blog/articles/trackback/7430</trackback:ping>
    </item>
    <item>
      <title>Google Sets + Sed = Quick Keywords for Meta Tags</title>
      <description>&lt;p&gt;I know there is alot of &lt;a href="http://www.problogger.net/archives/2005/08/15/search-engine-optimization-for-blogs/"&gt;talk&lt;/a&gt; about search engine optimization.  Additionally, I have &lt;strong&gt;no&lt;/strong&gt; idea whether or not keywords in the meta tag do anything to help people find your site.  With that said, I want to share how to &lt;strong&gt;quickly generate and format keywords for the meta tag&lt;/strong&gt;.&lt;/p&gt;


	&lt;p&gt;To generate keywords for a website, go to &lt;a href="http://labs.google.com/sets"&gt;Google Sets&lt;/a&gt;.  Enter some small group of keywords that describes your site.  For example, if I were maintaining a site on machine learning, I might enter the following terms: machine learning &amp;#38; artificial intelligence.  This search returns &lt;a href="http://labs.google.com/sets?hl=en&amp;#38;q1=artificial+intelligence&amp;#38;q2=machine+learning&amp;#38;q3=&amp;#38;q4=&amp;#38;q5=&amp;#38;btn=Large+Set"&gt;40 to 50 keywords related to machine learning&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;img src="http://jessirae.com/blog/files/googleSets.png" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Copy these keywords into a text file and delete any that aren&amp;#8217;t relevant or that are misleading.&lt;/p&gt;


	&lt;p&gt;Now, if you were to simply cut and paste this list of keywords into your &lt;span class="caps"&gt;HTML&lt;/span&gt; document, your document would be &lt;a href="http://headrush.typepad.com/creating_passionate_users/2006/03/code_like_a_gir.html"&gt;&lt;span class="caps"&gt;UGLY&lt;/span&gt;&lt;/a&gt; (eew!) and difficult to read.  Who wants to read a file with that many carriage returns?&lt;/p&gt;


	&lt;p&gt;The solution is to replace all end of line characters with commas (except the last &lt;span class="caps"&gt;EOL&lt;/span&gt;), so that things look relatively nice and neat in an html or rhtml or whatnot file.&lt;/p&gt;


	&lt;p&gt;To replace the end of line characters with commas, use the following two linux commands:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;sed &amp;#8217;/$/,/&amp;#8217; file1 &amp;gt; file2&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;paste -sd &amp;#8217;\0&amp;#8217; &amp;#8211; file2 &amp;gt; file3&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;You don&amp;#8217;t have to create two extra files, but I do because often I have compiled keywords from several searches and wouldn&amp;#8217;t want to repeat the process if I messed up the sed and paste commands.  Besides after I have inserted the keywords into my html, I simply delete the files.
&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;After getting all of the keywords on one line, paste them into the &amp;#8221;&amp;lt;META name=&amp;#8221;keyword&amp;#8221; content=&amp;#8221;&amp;#8221;&amp;gt; statement.&lt;/p&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;strong&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;&lt;/strong&gt;
&lt;br /&gt;
For Windows users, there are two things I can recommend you do if you would like to use these commands.
&lt;ul&gt;
First, if you are running a website that is on a server running linux, you can ssh into the server, upload the text file you would like to convert (file1 in my example), and then run sed and paste on that text file.
&lt;br /&gt;&lt;br /&gt;
Second, you can try to run &lt;a href="http://www.steve.org.uk/Software/bash/"&gt;&lt;span class="caps"&gt;GNU&lt;/span&gt; Bash shell on Windows&lt;/a&gt; or install &lt;a href="http://www.cygwin.com/"&gt;Cygwin&lt;/a&gt;.  I haven&amp;#8217;t tried either of these options because both my Windows laptop &lt;em&gt;and&lt;/em&gt; desktop died (RIP my sweet babies) a few months ago.
&lt;/ul&gt;</description>
      <pubDate>Tue, 17 Oct 2006 15:32:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:346032e2-8a14-405f-b0c7-5fef87cbfb02</guid>
      <author>Jessica</author>
      <link>http://www.jessirae.com/blog/articles/2006/10/17/google-sets-sed-quick-keywords-for-meta-tags</link>
      <category>technology</category>
      <category>keywords</category>
      <category>paste</category>
      <category>sed</category>
      <category>sets</category>
      <category>google</category>
      <category>search</category>
      <category>SEO</category>
      <trackback:ping>http://www.jessirae.com/blog/articles/trackback/194</trackback:ping>
    </item>
  </channel>
</rss>
