- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Copy ????.ABC ????BCD
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
тАО11-17-2005 09:47 AM
тАО11-17-2005 09:47 AM
Anyone have one handy ??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-17-2005 12:26 PM
тАО11-17-2005 12:26 PM
Solutionls -1 ????.ABC > list
while read -r filename
do
cp $filename ????BCD
done < list
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-17-2005 06:40 PM
тАО11-17-2005 06:40 PM
Re: Copy ????.ABC ????BCD
#!/usr/bin/perl
#
# use shift to extract the first command line argument - this is the string
# containing the Perl statement(s) to be compiled and executed.
# These Perl operations are stored in a $op variable.
($op = shift) || die "Usage: rename expr [files]\n";
chomp(@ARGV =
foreach (@ARGV) {
# save the current file name in $was
$was = $_; # $_ is the default loop variable
eval $op; # compile and execute the Perl
# operations submitted by the user
die if $@; # means eval 'failed'
rename($was, $_) unless $was eq $_; # rename is a Perl built-in function
}
Then you use it like this:
rename 's/\.ABC$/BCD/' *.ABC
or maybe you meant:
rename.pl 's/\.ABC$/\.BCD/' *.ABC
HTH,
Ross
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-17-2005 10:29 PM
тАО11-17-2005 10:29 PM
Re: Copy ????.ABC ????BCD
Works better without the -l in the ls command;
Thanks !!
The Perl script is good too ! Thanks.
VEB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-17-2005 11:04 PM
тАО11-17-2005 11:04 PM
Re: Copy ????.ABC ????BCD
Sorry for the confusion.
thats supposed to be a dash one
-1
What dash one does is create a file list one file per line.
Its possible under certain circumstances at least under hpux to get two files on the same line. dash one prevents that.
I didn't realize with browser fonts and such I needed to clarify its not a dash el.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 03:06 AM
тАО11-18-2005 03:06 AM
Re: Copy ????.ABC ????BCD
I tried the script, but would up with the actual ????.EXT question marks in the file name.
code:
unzip ???????k.zip
ls ???????.DRF > list
while read -r filename
do
cp $filename ???????.STK
done < list
Wound up with a file ???????.STK. I'm looking for LAD1117.STK. ( converting horse racing data files from DRF to STK file extension)
Thanks for your help. Still needs work :o)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 03:17 AM
тАО11-18-2005 03:17 AM
Re: Copy ????.ABC ????BCD
code:
unzip ???????k.zip
ls ???????.DRF > list
while read -r filename
do
cp $filename $filename.STK
done < list
Wound up with: LAD1117.DRF.STK
Closer but now I need to strip the .DRF; maybe there's a way to strip $filename to the first seven characters; that would do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2005 06:29 AM
тАО11-19-2005 06:29 AM
Re: Copy ????.ABC ????BCD
if it is just a mattter of shortening "filename", you could try a small change like this:
.....
while read -r filename
do
#insert cut of filename
if [ "${#filename}" -gt 7 ]
then
filename=$(echo "$filename" | cut -c1-7)
fi
# insert end
cp "$filename" "$filename.STK"
done < list
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2005 08:17 AM
тАО11-19-2005 08:17 AM
Re: Copy ????.ABC ????BCD
Vern