Mike Shannon - Linux http://www.mikeshannon.com/taxonomy/term/3/0 en Linux: change a large number of file names, all at once http://www.mikeshannon.com/linux-change-large-number-file-names-all-once <p>How do I change a lot of file names all at once, and using the linux command line? &nbsp;Look no further. &nbsp;Let&rsquo;s say you have a bunch of images in your current directory (let&rsquo;s create them like so for testing purposes):</p> <p>for x in {1..100}; do touch &ldquo;image$x.gif&rdquo;; done</p> <p>Now that you have all 100 gif images files, just run the following command to change them to have the .jpg file extension:</p> <p>for x in *.gif; do mv &ldquo;$x&rdquo; &ldquo;${x%.gif}.jpg&rdquo;; done</p> <p><a href="http://www.mikeshannon.com/linux-change-large-number-file-names-all-once" target="_blank">read more</a></p> http://www.mikeshannon.com/linux-change-large-number-file-names-all-once#comments How To Linux Fri, 06 Feb 2009 00:57:07 +0000 admin 88 at http://www.mikeshannon.com Search and Replace using the vi Editor http://www.mikeshannon.com/search-and-replace-using-vi-editor <p>&nbsp;If you&rsquo;re like me then you&rsquo;re using the unix vi editor like an oxygen tank on mars. But seriously, I&rsquo;ve always liked the search and replace feature from other graphical based text editors so it&rsquo;s only fair that we learn how to use vi&rsquo;s search and replace function. It&rsquo;s extremely useful and easy once you get the hang of it.</p> <p><span class="geshifilter"><code class="geshifilter-bash">:<span style="color: #000000; font-weight: bold;">%</span>s<span style="color: #000000; font-weight: bold;">/</span>old_string<span style="color: #000000; font-weight: bold;">/</span>new_string<span style="color: #000000; font-weight: bold;">/</span>g</code></span></p> <p><a href="http://www.mikeshannon.com/search-and-replace-using-vi-editor" target="_blank">read more</a></p> http://www.mikeshannon.com/search-and-replace-using-vi-editor#comments Linux Tips Thu, 06 Mar 2008 20:12:58 +0000 admin 74 at http://www.mikeshannon.com