Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Case change copy
All:

Is there a Unix command that would allow me to copy(cp) a file and have
the target filename forced to uppercase?

ie myfile.dat --> MYFILE.DAT

or is there some Unix shell script code that can do this?

Thanks in advance,
George


Report this thread to moderator Post Follow-up to this message
Old Post
GeorgeM
09-30-06 12:01 AM


Re: Case change copy
GeorgeM wrote:
> All:
>
> Is there a Unix command that would allow me to copy(cp) a file and have
> the target filename forced to uppercase?
>
> ie myfile.dat --> MYFILE.DAT
>
> or is there some Unix shell script code that can do this?

I'm sure there may be simpler ways to do it, but:



FILE=lower.txt
cp $FILE $(echo $FILE | tr 'a-z' 'A-Z')



Something in this direction may be useful for more elaborate things:

paste <(ls) <(ls |tr 'a-z' 'A-Z') |sed -e 's/^/cp /'

(That won't do the right thing for directories, I'm just trying to give
you a rough idea.)


There's probably a million ways to do this...

Report this thread to moderator Post Follow-up to this message
Old Post
jmcgill
09-30-06 12:01 AM


Re: Case change copy
Thanks Jill, this works great for a file name alone..Actually my
variable includes the filename and full path. What would be a way to do
it with the directory path included?

Thanks,
George


jmcgill wrote:
> GeorgeM wrote: 
>
> I'm sure there may be simpler ways to do it, but:
>
>
>
> FILE=lower.txt
> cp $FILE $(echo $FILE | tr 'a-z' 'A-Z')
>
>
>
> Something in this direction may be useful for more elaborate things:
>
> paste <(ls) <(ls |tr 'a-z' 'A-Z') |sed -e 's/^/cp /'
>
> (That won't do the right thing for directories, I'm just trying to give
> you a rough idea.)
>
>
> There's probably a million ways to do this...


Report this thread to moderator Post Follow-up to this message
Old Post
GeorgeM
09-30-06 12:01 AM


Re: Case change copy
Thanks Jill, this works great for a file name alone..Actually my
variable includes the filename and full path. What would be a way to do
it with the directory path included?

Thanks,
George


jmcgill wrote:
> GeorgeM wrote: 
>
> I'm sure there may be simpler ways to do it, but:
>
>
>
> FILE=lower.txt
> cp $FILE $(echo $FILE | tr 'a-z' 'A-Z')
>
>
>
> Something in this direction may be useful for more elaborate things:
>
> paste <(ls) <(ls |tr 'a-z' 'A-Z') |sed -e 's/^/cp /'
>
> (That won't do the right thing for directories, I'm just trying to give
> you a rough idea.)
>
>
> There's probably a million ways to do this...


Report this thread to moderator Post Follow-up to this message
Old Post
GeorgeM
09-30-06 12:01 AM


Re: Case change copy
GeorgeM wrote:
> [M]y variable includes the filename and full path. What would be a way to do
> it with the directory path included?

man basename

Report this thread to moderator Post Follow-up to this message
Old Post
jmcgill
09-30-06 12:01 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:15 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.