- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: About script writing
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
06-11-2003 11:51 PM
06-11-2003 11:51 PM
The user will generate some .txt files to the system , how can i write a script to change all these .txt to .prn format ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2003 11:57 PM
06-11-2003 11:57 PM
Solutiondo you want to change only the name, or do you want to actually change the contents ? If you want to change the contents, I suggest you use perl. And you you need to understand the format of the prn file, which I'm not familiar with.
If prn is a binary file, you need to other tools than shell commands to do the job.
Rgds Jarle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2003 12:02 AM
06-12-2003 12:02 AM
Re: About script writing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2003 12:14 AM
06-12-2003 12:14 AM
Re: About script writing
try this :
for FILE in $(find
do
mv $FILE $(dirname $FILE )/$(basename $FILE | cut -d. -f1)
done
Regards,
Fr??d??ric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2003 12:16 AM
06-12-2003 12:16 AM
Re: About script writing
try this.
#$/bin/sh
for i in $(ls /your_directory_with_txt_files/*.txt)
do
mv $i /your_directory_with_txt_files/$(basename $i .txt).prn
done
Or you could give the directory as an argument to the script, and replace your_directory_with_txt_files with $1
Rgds Jarle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2003 12:51 AM
06-12-2003 12:51 AM
Re: About script writing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2003 05:33 AM
06-12-2003 05:33 AM
Re: About script writing
"Korn Shell Programming by example" by O'Brien, Pitts
&
"sed & awk" by Dougherty & Robbins
for your problem I would write this script:
#! /usr/bin/ksh
for i in $(ls /path/to/files)
do
file=$(echo $i | sed 's/.txt//g')
mv $file $file.txt
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2003 04:57 PM
06-12-2003 04:57 PM
Re: About script writing
If you are new to shell scripting, please buy
this book Hands-On Kronshell93 programming
(ISBN:0-201-31018X other book is Kronshell
Programming Tutorial by Barry Rosenberg
The latest is KSH93 go for it,grate book
by very clear examples.
You can become shell Master.
Good luck
Ashan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2003 05:38 PM
06-12-2003 05:38 PM