<?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: Korn Shell Scripting problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507302#M892148</link>
    <description>for file in * ; do&lt;BR /&gt; newnam="${file##*.}.pdf"&lt;BR /&gt; mv $file $newname&lt;BR /&gt;done</description>
    <pubDate>Tue, 20 Mar 2001 16:59:46 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2001-03-20T16:59:46Z</dc:date>
    <item>
      <title>Korn Shell Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507300#M892146</link>
      <description>Hello All-&lt;BR /&gt;&lt;BR /&gt;I need a line to add to the following shell script that will rename files from this format&lt;BR /&gt;&lt;BR /&gt;JJONES.12345&lt;BR /&gt;THONEYCUTT.44332&lt;BR /&gt;RCRASUS.55555&lt;BR /&gt;&lt;BR /&gt;to this format&lt;BR /&gt;&lt;BR /&gt;12345.pdf&lt;BR /&gt;44332.pdf&lt;BR /&gt;55555.pdf&lt;BR /&gt;&lt;BR /&gt;respectively.&lt;BR /&gt;&lt;BR /&gt;Basically dropping the original alphabetic prefix, making the numeric extension the new prefix, and adding a .pdf extension.  This is not a conversion job, just a renaming.&lt;BR /&gt;&lt;BR /&gt;The original filenames are passed to the script in variable format by an oracle application.  The file needs to be renamed before it is copied to it's destination (invoice_in)&lt;BR /&gt;&lt;BR /&gt;Any help on this issue would be greatly appreciated!&lt;BR /&gt;&lt;BR /&gt;--BEGIN KORN SHELL SCRIPT--&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;# A simple script to copy a file submited to invoicetopdf to the invoice_in&lt;BR /&gt;# directory.  It takes the first positional parameter as its only argument.&lt;BR /&gt;&lt;BR /&gt;echo "I am in the script" &amp;gt;&amp;gt; /tmp/inv.err&lt;BR /&gt;echo $# &amp;gt;&amp;gt; /tmp/inv.err&lt;BR /&gt;echo $* &amp;gt;&amp;gt; /tmp/inv.err&lt;BR /&gt;echo "File name is: $1" &amp;gt;&amp;gt; /tmp/inv.err&lt;BR /&gt;cp $1 $APPL_TOP/ecan/invoice_in/in/  &amp;gt;&amp;gt; /tmp/inv.err&lt;BR /&gt;print $? &amp;gt;&amp;gt; /tmp/inv.err&lt;BR /&gt;&lt;BR /&gt;--END OF SCRIPT--&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;Thanks-Jeremy&lt;BR /&gt;&lt;BR /&gt;ifjq216@hotmail.com&lt;BR /&gt;jeremy@neosurf.net</description>
      <pubDate>Tue, 20 Mar 2001 16:45:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507300#M892146</guid>
      <dc:creator>Jeremy_5</dc:creator>
      <dc:date>2001-03-20T16:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507301#M892147</link>
      <description>Your processing loop should be something like:-&lt;BR /&gt;&lt;BR /&gt;for FILE in ${*}&lt;BR /&gt;do&lt;BR /&gt; SUFFIX=${FILE#*.}  # leave chars after final .&lt;BR /&gt; cp (or mv) ${FILE} &lt;WHEREVER&gt;/${SUFFIX}.pdf&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;/WHEREVER&gt;</description>
      <pubDate>Tue, 20 Mar 2001 16:56:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507301#M892147</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2001-03-20T16:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507302#M892148</link>
      <description>for file in * ; do&lt;BR /&gt; newnam="${file##*.}.pdf"&lt;BR /&gt; mv $file $newname&lt;BR /&gt;done</description>
      <pubDate>Tue, 20 Mar 2001 16:59:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507302#M892148</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2001-03-20T16:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507303#M892149</link>
      <description>You could also use the cut feature:&lt;BR /&gt;&lt;BR /&gt;var1="`echo $1 | cut -d. -f2`.pdf"&lt;BR /&gt;mv $1 $var1</description>
      <pubDate>Tue, 20 Mar 2001 17:03:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507303#M892149</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-03-20T17:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507304#M892150</link>
      <description>filename=$(cat $yourfilename | sed -n 's|^[A-Z]*\.\([0-9]*\)$|\1.pdf|p)&lt;BR /&gt;if [[ -z $filename ]] ;then&lt;BR /&gt;invalid file name message&lt;BR /&gt;exit&lt;BR /&gt;fi</description>
      <pubDate>Tue, 20 Mar 2001 17:09:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507304#M892150</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-03-20T17:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507305#M892151</link>
      <description>Unless you know for sure that each numeric suffix of the old filename will be unique from any other suffix, I would also add code to check for the existance of the new filename before you write it.  Otherwise you may end up overwriting other output.</description>
      <pubDate>Tue, 20 Mar 2001 17:14:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507305#M892151</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2001-03-20T17:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell Scripting problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507306#M892152</link>
      <description>a million ways to skin a cat.&lt;BR /&gt;&lt;BR /&gt;newfile=`echo $file | awk -F \. '{print $2}'`.pdf&lt;BR /&gt;mv $file $newfile&lt;BR /&gt;&lt;BR /&gt;...jcd...</description>
      <pubDate>Tue, 20 Mar 2001 17:31:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-scripting-problem/m-p/2507306#M892152</guid>
      <dc:creator>Joseph C. Denman</dc:creator>
      <dc:date>2001-03-20T17:31:57Z</dc:date>
    </item>
  </channel>
</rss>

