<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: remove certain characters from file name in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919389#M407487</link>
    <description>you can change your IFS to something else i.e. | or , &lt;BR /&gt;&lt;BR /&gt;Make sure you change it back or only set for your session.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 19 Aug 2005 11:11:39 GMT</pubDate>
    <dc:creator>Tim Nelson</dc:creator>
    <dc:date>2005-08-19T11:11:39Z</dc:date>
    <item>
      <title>remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919380#M407478</link>
      <description>I have a directory that has about 200 files, I need to go thru and remove any " - " (dash) from the files, how can I do this.</description>
      <pubDate>Thu, 18 Aug 2005 16:50:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919380#M407478</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2005-08-18T16:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919381#M407479</link>
      <description>for file in `ls -1`&lt;BR /&gt;do&lt;BR /&gt;newname=`echo $file | sed -e "1,1s/-//g"`&lt;BR /&gt;mv $file $newname&lt;BR /&gt;done</description>
      <pubDate>Thu, 18 Aug 2005 16:53:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919381#M407479</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-08-18T16:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919382#M407480</link>
      <description>Better yet, how about just removing the first - it sees in the filename&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 16:53:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919382#M407480</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2005-08-18T16:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919383#M407481</link>
      <description>Actually,&lt;BR /&gt;&lt;BR /&gt;for file in `ls -1 *-*`&lt;BR /&gt;do&lt;BR /&gt;newname=`echo $file | sed -e "1,1s/-//g"`&lt;BR /&gt;mv $file $newname&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;is better as the first version will complain for the files without dashes in their names, although it will do the job as well.</description>
      <pubDate>Thu, 18 Aug 2005 16:54:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919383#M407481</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-08-18T16:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919384#M407482</link>
      <description>to remove the first occurance of "-" just drop the "g" at the end of the sed directive as such:&lt;BR /&gt;&lt;BR /&gt;for file in `ls -1 *-*`&lt;BR /&gt;do&lt;BR /&gt;newname=`echo $file | sed -e "1,1s/-//"`&lt;BR /&gt;mv $file $newname&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2005 16:56:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919384#M407482</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-08-18T16:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919385#M407483</link>
      <description>To remove the first occurence of "dash" in the filename you could use the awk construct below:&lt;BR /&gt;&lt;BR /&gt;# ls *-* | awk -F"-" '{x=$0;sub("-","",$0);system("mv "x" "$0)}'</description>
      <pubDate>Thu, 18 Aug 2005 17:56:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919385#M407483</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-08-18T17:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919386#M407484</link>
      <description>To remove all occurences of "dash" in a filename here's a slightly modified version of the awk construct posted previously:&lt;BR /&gt;&lt;BR /&gt;# ls *-* | awk -F"-" '{x=$0;gsub("-","");system("mv "x" "$0)}'</description>
      <pubDate>Thu, 18 Aug 2005 18:09:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919386#M407484</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-08-18T18:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919387#M407485</link>
      <description>You can do it as,&lt;BR /&gt;&lt;BR /&gt;cd &lt;DIRECTORY&gt;&lt;BR /&gt;for file in `find . -type f`&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt; mv $file $(echo $file | tr -d '-')&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/DIRECTORY&gt;</description>
      <pubDate>Fri, 19 Aug 2005 00:16:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919387#M407485</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-08-19T00:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919388#M407486</link>
      <description>This is all good, but I have spaces in my file names, so it trys to do it per word...</description>
      <pubDate>Fri, 19 Aug 2005 10:01:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919388#M407486</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2005-08-19T10:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919389#M407487</link>
      <description>you can change your IFS to something else i.e. | or , &lt;BR /&gt;&lt;BR /&gt;Make sure you change it back or only set for your session.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Aug 2005 11:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919389#M407487</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2005-08-19T11:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919390#M407488</link>
      <description>Another thought.  you can use the same SED commands to replace the space with \space &lt;BR /&gt;&lt;BR /&gt;Worth a try.</description>
      <pubDate>Fri, 19 Aug 2005 11:12:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919390#M407488</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2005-08-19T11:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919391#M407489</link>
      <description>or you can use Mel's suggestion - remember to use plenty of qoutes, e.g.:&lt;BR /&gt; &lt;BR /&gt;for file in "`ls -1 *-*`"&lt;BR /&gt;do&lt;BR /&gt;newname=`echo "$file" | sed -e "1,1s/-//g"`&lt;BR /&gt;mv "$file" "$newname"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Fri, 19 Aug 2005 11:21:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919391#M407489</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-08-19T11:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919392#M407490</link>
      <description>to remove all the dashes&lt;BR /&gt;&lt;BR /&gt;ls -1 *-* | while read file&lt;BR /&gt;do&lt;BR /&gt;newname=`echo "$file" | sed -e "1,1s/-//g"`&lt;BR /&gt;mv "$file" "$newname"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;to remove the first occurance of dash&lt;BR /&gt;&lt;BR /&gt;ls -1 *-* | while read file&lt;BR /&gt;do&lt;BR /&gt;newname=`echo "$file" | sed -e "1,1s/-//"`&lt;BR /&gt;mv "$file" "$newname"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Aug 2005 11:26:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919392#M407490</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-08-19T11:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919393#M407491</link>
      <description>This one works in sh, ksh.&lt;BR /&gt; &lt;BR /&gt;IFS="|"&lt;BR /&gt;for i in *; do mv $i ${i/-/}; done&lt;BR /&gt;unset IFS</description>
      <pubDate>Fri, 19 Aug 2005 11:30:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919393#M407491</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-08-19T11:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919394#M407492</link>
      <description>The above one works with file names that have spaces in the file name (forgot to mention that).</description>
      <pubDate>Fri, 19 Aug 2005 11:58:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919394#M407492</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-08-19T11:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919395#M407493</link>
      <description>To remove all dashes from a filename that has spaces too use the awk construct below. This won't remove spaces from a filename, only dashes:&lt;BR /&gt;&lt;BR /&gt;# ls *-*\ * | awk '{x=$0;gsub(" ","\ ");gsub("-","");gsub(" ","\ ",x);system("mv "x" "$0)}'&lt;BR /&gt;&lt;BR /&gt;awk construct below to remove the first "dash" from a filename that has spaces. Again, this won't remove spaces from a filename, only the first dash:&lt;BR /&gt;&lt;BR /&gt;# ls *-*\ * | awk '{x=$0;gsub(" ","\ ");sub("-","");gsub(" ","\ ",x);system("mv "x" "$0)}'&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Mon, 22 Aug 2005 13:12:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919395#M407493</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-08-22T13:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: remove certain characters from file name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919396#M407494</link>
      <description>Thanks for all the help</description>
      <pubDate>Tue, 23 Aug 2005 15:32:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-certain-characters-from-file-name/m-p/4919396#M407494</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2005-08-23T15:32:38Z</dc:date>
    </item>
  </channel>
</rss>

