Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>short answer</h2> <p><br/> On <strong>Windows</strong>, you can use PowerShell, that is installed by default on Windows 7, and can be downloaded and installed on previous versions. With PowerShell you can do the rename as:</p> <pre class="lang-sh prettyprint-override"><code>ls | foreach-object -process {ren $_ (%{$_ -replace "-straight",""})} </code></pre> <p>On <strong>Unix/Linux</strong>, nothing specific needs to be installed, and you can do the rename as: </p> <pre class="lang-sh prettyprint-override"><code>ls | awk '{print("mv "$1" "$1)}' | cut -f -3,5- -d '-' | sh </code></pre> <p><br></p> <h2>examples</h2> <h2>Windows Example</h2> <h3><em>Given</em></h3> <pre class="lang-sh prettyprint-override"><code>PS C:\rename-me&gt; ls Directory: C:\rename-me Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 10/9/2011 1:35 PM 0 REDHI20806-straight-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20807-straight-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20808-straight-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20809-straight-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20810-straight-bottle.png </code></pre> <h3><em>Doing It</em></h3> <pre class="lang-sh prettyprint-override"><code>PS C:\rename-me&gt; ls | foreach-object -process {ren $_ (%{$_ -replace "-straight",""})} </code></pre> <h3><em>Result</em></h3> <pre class="lang-sh prettyprint-override"><code>PS C:\rename-me&gt; ls Directory: C:\rename-me Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 10/9/2011 1:35 PM 0 REDHI20806-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20807-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20808-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20809-bottle.png -a--- 10/9/2011 1:35 PM 0 REDHI20810-bottle.png </code></pre> <p><br></p> <h2>Unix/Linux Example</h2> <h3><em>Given</em></h3> <pre class="lang-sh prettyprint-override"><code>$ ls -l total 0 -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20806-straight-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20807-straight-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20808-straight-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20809-straight-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20810-straight-bottle.png </code></pre> <h3><em>Doing It</em></h3> <pre class="lang-sh prettyprint-override"><code>$ ls | awk '{print("mv "$1" "$1)}' | cut -f -3,5- -d '-' | sh </code></pre> <h3><em>Result</em></h3> <pre class="lang-sh prettyprint-override"><code>$ ls -l total 0 -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20806-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20807-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20808-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20809-bottle.png -rw-r--r-- 1 user staff 0 Oct 7 00:54 REDHI20810-bottle.png </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload