<?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: Need help writing a shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467189#M774573</link>
    <description>Try this:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;#&lt;BR /&gt;# renames without the last extension.&lt;BR /&gt;&lt;BR /&gt;OLDNAME=$1&lt;BR /&gt;NEWNAME=` echo $OLDNAME | awk '{ n=split($1,filen,".")&lt;BR /&gt;for (i = 1; i &amp;lt; n ; i++ ) printf filen[i]"." }'`&lt;BR /&gt;mv $OLDNAME $NEWNAME&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 24 Nov 2000 19:32:06 GMT</pubDate>
    <dc:creator>Kofi ARTHIABAH</dc:creator>
    <dc:date>2000-11-24T19:32:06Z</dc:date>
    <item>
      <title>Need help writing a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467187#M774571</link>
      <description>please help me with this!!&lt;BR /&gt;&lt;BR /&gt;I need to write a shell script that removes the characters given as the second argument from the end of the name of the file given as the first argument. So memo1.sv should rename memo1.sv to memo1. &lt;BR /&gt;&lt;BR /&gt;Thanks for all your kind help!!!!</description>
      <pubDate>Fri, 24 Nov 2000 18:11:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467187#M774571</guid>
      <dc:creator>sanman_2</dc:creator>
      <dc:date>2000-11-24T18:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Need help writing a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467188#M774572</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;A simple script with no error checking follows:-&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;FILE=${1}&lt;BR /&gt;SUFFIX=${2}&lt;BR /&gt;NEWFILE=${FILE%${SUFFIX}}&lt;BR /&gt;&lt;BR /&gt;mv ${FILE} ${NEWFILE}&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;Call it with:-&lt;BR /&gt;&lt;BR /&gt;&amp;lt;scriptname&amp;gt; &lt;FILENAME&gt; &lt;CHARS to="" be="" removed=""&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;/CHARS&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Fri, 24 Nov 2000 18:51:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467188#M774572</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2000-11-24T18:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need help writing a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467189#M774573</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;#&lt;BR /&gt;# renames without the last extension.&lt;BR /&gt;&lt;BR /&gt;OLDNAME=$1&lt;BR /&gt;NEWNAME=` echo $OLDNAME | awk '{ n=split($1,filen,".")&lt;BR /&gt;for (i = 1; i &amp;lt; n ; i++ ) printf filen[i]"." }'`&lt;BR /&gt;mv $OLDNAME $NEWNAME&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 24 Nov 2000 19:32:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467189#M774573</guid>
      <dc:creator>Kofi ARTHIABAH</dc:creator>
      <dc:date>2000-11-24T19:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need help writing a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467190#M774574</link>
      <description>#!/sbin/sh&lt;BR /&gt;mv $1 $(basename $1 .$2)&lt;BR /&gt;&lt;BR /&gt;call it with ie&lt;BR /&gt;&lt;BR /&gt;&amp;lt;script&amp;gt; file.ext ext</description>
      <pubDate>Mon, 27 Nov 2000 07:12:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467190#M774574</guid>
      <dc:creator>Rainer_1</dc:creator>
      <dc:date>2000-11-27T07:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need help writing a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467191#M774575</link>
      <description>to rename a file with an arbitary extension&lt;BR /&gt;&lt;BR /&gt;#/sbin/sh&lt;BR /&gt;mv $1 $(echo $1|sed 's/\(.*\)\..*$/\1/')&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Nov 2000 08:15:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467191#M774575</guid>
      <dc:creator>Rainer_1</dc:creator>
      <dc:date>2000-11-27T08:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need help writing a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467192#M774576</link>
      <description>If you want to do it for any filename recursively:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;if [ $# = 0 ]; then&lt;BR /&gt;  echo "Arg: fileSuffix"&lt;BR /&gt;  exit&lt;BR /&gt;fi&lt;BR /&gt;MV=/tmp/mvSuff&lt;BR /&gt;echo 'mv $1 $(dirname $1)/$(basename $1 .'"$1"')' &amp;gt; $MV&lt;BR /&gt;chmod +x $MV&lt;BR /&gt;find . -name "*.$1" -exec $MV {} \;&lt;BR /&gt;rm $MV&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Nov 2000 14:12:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-writing-a-shell-script/m-p/2467192#M774576</guid>
      <dc:creator>Tommy Palo</dc:creator>
      <dc:date>2000-11-27T14:12:46Z</dc:date>
    </item>
  </channel>
</rss>

