Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this messageGeorgeM 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...
Post Follow-up to this messageThanks 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...
Post Follow-up to this messageThanks 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...
Post Follow-up to this messageGeorgeM 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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.