- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to convert files names to upper case
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
Discussions
Discussions
Forums
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
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
тАО09-13-2004 03:42 AM
тАО09-13-2004 03:42 AM
e.g. myfile.dat becomes MYFILE.dat
I remember the use of "foreach file" command under csh but cant get the file conversion right.
I have been trying the following but cant get it to work.
foreach file (*.dat)
mv $file tr `basename $file .dat`.dat
end
Is there a better way, am I on the right track.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2004 03:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2004 05:24 AM
тАО09-13-2004 05:24 AM
Re: how to convert files names to upper case
do
FILE=$(echo "$F" | sed 's/\(.*\)\./\1/' | tr "[:lower:]" "[:upper:]")
EXT=$(echo "$F" | sed 's/.*\(\..*\)/\1/' )
mv $F ${FILE}${EXT}
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2004 09:42 PM
тАО09-13-2004 09:42 PM
Re: how to convert files names to upper case
typeset -u newfile
for oldfile in *.dat
do
newfile=${oldfile%.dat}
mv ${oldfile} ${newfile}.dat
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2004 10:37 PM
тАО09-13-2004 10:37 PM
Re: how to convert files names to upper case
# for file in `ls .`; do
> cp $file `echo $file | cut -d "." -f 1 | tr '[a-z]' '[A-Z]'`.dat
> done
It will do.