- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Korn Shell Scripting problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 08:45 AM
03-20-2001 08:45 AM
I need a line to add to the following shell script that will rename files from this format
JJONES.12345
THONEYCUTT.44332
RCRASUS.55555
to this format
12345.pdf
44332.pdf
55555.pdf
respectively.
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.
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)
Any help on this issue would be greatly appreciated!
--BEGIN KORN SHELL SCRIPT--
#!/usr/bin/ksh
# A simple script to copy a file submited to invoicetopdf to the invoice_in
# directory. It takes the first positional parameter as its only argument.
echo "I am in the script" >> /tmp/inv.err
echo $# >> /tmp/inv.err
echo $* >> /tmp/inv.err
echo "File name is: $1" >> /tmp/inv.err
cp $1 $APPL_TOP/ecan/invoice_in/in/ >> /tmp/inv.err
print $? >> /tmp/inv.err
--END OF SCRIPT--
Thanks-Jeremy
ifjq216@hotmail.com
jeremy@neosurf.net
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 08:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 08:59 AM
03-20-2001 08:59 AM
Re: Korn Shell Scripting problem
newnam="${file##*.}.pdf"
mv $file $newname
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 09:03 AM
03-20-2001 09:03 AM
Re: Korn Shell Scripting problem
var1="`echo $1 | cut -d. -f2`.pdf"
mv $1 $var1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 09:09 AM
03-20-2001 09:09 AM
Re: Korn Shell Scripting problem
if [[ -z $filename ]] ;then
invalid file name message
exit
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 09:14 AM
03-20-2001 09:14 AM
Re: Korn Shell Scripting problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2001 09:31 AM
03-20-2001 09:31 AM
Re: Korn Shell Scripting problem
newfile=`echo $file | awk -F \. '{print $2}'`.pdf
mv $file $newfile
...jcd...