02-25-2007
Renaming the files
Hello,
i wanna rename my files which names are written in movies.txt
films.txt = amovie
bmovie
cmovie
dmovie
emovie
and i wanna find this files and rename the files to 1_amovie
2_bmovie
3_cmovie
4_dmovie
5_emovie
Thanks for answers.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
i have a set of *.lst files. now i want to change the names from "lst" to "dat". how to do it?
ex.:
-rw-r--r-- 1 rram group 22 Sep 21 13:10 a.lst
-rw-r--r-- 1 rram group 22 Sep 21 13:09 b.lst
-rw-r--r-- 1 rram group 22 Sep 21 13:10 c.lst... (4 Replies)
Discussion started by: raguramtgr
4 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
Today I got a small problem while handling zipped files in PROD support.
There are files in this format and I had to grep them reading some contents
A.B.gz.C.D
where A,B,C and D stand for variables (like FIRST.NAME.gz.MIDDLE.LAST).
I know that these files are zipped files and If I... (1 Reply)
Discussion started by: adurga
1 Replies
3. UNIX for Dummies Questions & Answers
directory name = /usr/tom/1997
files -
ABC_1997_ST1_BCD.SQL
BCD_1997_ST1_EFG_SAB.SQL
TTT_EBC_1997_ST1_A.SQL
sub directory - /usr/tom/1997/jan
a) I want to just rename the all files ending with '.SQL' and also its contents in the 1997 directory(excluding subdirectories eg... (3 Replies)
Discussion started by: systemsb
3 Replies
4. UNIX for Dummies Questions & Answers
Hello!
I am not familiar with UNIX and I have this problem:
I need to move files from a UNIX machine to a PC. UNIX file names contain ":" as special character which is not recognized in a PC.
How can I change ":" for "_" in the name of a bunch of files in UNIX?
Thanks for your help. (7 Replies)
Discussion started by: Tygoon
7 Replies
5. UNIX for Dummies Questions & Answers
I have a list of files named ab_*.csv
I would like to remane them all by removing the ab_ and have *.csv
I did the following but I am surely missing something.
/* wrong script */
for i in `ls -1 ab_*`; do mv ab_$i $i; done
Thanks in advance. (1 Reply)
Discussion started by: jxh461
1 Replies
6. Shell Programming and Scripting
Hi all,
using a utility image file was named starting with blank space and a blank space in between. I want to rename the files.
file names are in the format " sb 12.tif"," sb 13.tif"," sb 14.tif" the files are in thousands. i want to rename as 12.tif, 13.tif, 14.tif....
thanks. (3 Replies)
Discussion started by: ahkverma
3 Replies
7. Shell Programming and Scripting
Hi All
I have a folder that contains hundreds of file with a names
3.msa
4.msa
21.msa
6.msa
345.msa
456.msa
98.msa
...
...
...
I need rename each of this file by adding "core_" in the begiining of each file such as
core_3.msa
core_4.msa
core_21.msa (4 Replies)
Discussion started by: Lucky Ali
4 Replies
8. Shell Programming and Scripting
Hi,
I have a list of files in a folder with the same name ending (over 1000 files)
joe.jpy.jpeg
joe1.jpy.jpeg
joe2.jpy.jpeg
jon3.jpy.jpeg
jor5.jpy.jpeg
.....jpy.jpeg
etc.
I want to change jpy to hhk
So the output will be:
joe.hhk.jpeg
joe1.hhk.jpeg
joe2.hhk.jpeg
jon3.hhk.jpeg... (3 Replies)
Discussion started by: kylle345
3 Replies
9. Shell Programming and Scripting
Hello,
I am looking for a command line that will rename name files :
f700_abc_o_t_MASTERID_AS_AE_20130323.csv
like this
f700_abc_o_t_MASTERID_AS_AE_20130324.csv
The great idea could be to get the date stamp 20130323
and change any part of it, instead of just change the... (4 Replies)
Discussion started by: Aswex
4 Replies
10. Shell Programming and Scripting
Hi,
In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this?
I am using #!/bin/ksh
For eg: sftp user@host <<EOF
cd /path
get *.txt
rename *.txt *.txt.done
... (7 Replies)
Discussion started by: jhilmil
7 Replies
LEARN ABOUT DEBIAN
test::hasversion
HasVersion(3pm) User Contributed Perl Documentation HasVersion(3pm)
NAME
Test::HasVersion - Check Perl modules have version numbers
SYNOPSIS
"Test::HasVersion" lets you check a Perl module has a version number in a "Test::Simple" fashion.
use Test::HasVersion tests => 1;
pm_version_ok("M.pm", "Valid version");
Module authors can include the following in a t/has_version.t file and let "Test::HasVersion" find and check all installable PM files in a
distribution.
use Test::More;
eval "use Test::HasVersion";
plan skip_all =>
'Test::HasVersion required for testing for version numbers' if $@;
all_pm_version_ok();
DESCRIPTION
Do you wanna check that every one of your Perl modules in a distribution has a version number? You wanna make sure you don't forget the
brand new modules you just added? Well, that's the module you have been looking for. Use it!
Do you wanna check someone else's distribution to make sure the author have not commited the sin of leaving Perl modules without a version
that can be used to tell if you have this or that feature? "Test::HasVersion" is also for you, nasty little fellow.
There's a script test_version which is installed with this distribution. You may invoke it from within the root directory of a distribution
you just unpacked, and it will check every .pm file in the directory and under lib/ (if any).
$ test_version
You may also provide directories and files as arguments.
$ test_version *.pm lib/ inc/
$ test_version .
(Be warned that many Perl modules in a t/ directory do not receive versions because they are not used outside the distribution.)
Ok. That's not a very useful module by now. But it will be. Wait for the upcoming releases.
FUNCTIONS
PRIVATE _pm_version
$v = _pm_version($pm);
Parses a PM file and return what it thinks is $VERSION in this file. (Actually implemented with "use ExtUtils::MakeMaker;
MM->parse_version($file)".) $pm is the filename (eg., lib/Data/Dumper.pm).
pm_version_ok
pm_version_ok('Module.pm');
pm_version_ok('M.pm', 'Has valid version');
Checks to see if the given file has a valid version. Actually a valid version number is defined and not equal to 'undef' (the string)
which is return by "_pm_version" if a version cannot be determined.
all_pm_version_ok
all_pm_version_ok();
all_pm_version_ok(@PM_FILES);
Checks every given file and .pm files found under given directories to see if they provide valid version numbers. If no argument is
given, it defaults to check every file *.pm in the current directory and recurses under the lib/ directory (if it exists).
If no test plan was setted, "Test::HasVersion" will set one after computing the number of files to be tested. Otherwise, the plan is
left untouched.
PRIVATE _list_pm_files
@pm_files = _list_pm_files(@dirs);
Returns all PM files under the given directories.
all_pm_files
@files = all_pm_files()
@files = all_pm_files(@files_and_dirs);
Implements finding the Perl modules according to the semantics of the previous function "all_pm_version_ok".
USAGE
Other usage patterns besides the ones given in the synopsis.
use Test::More tests => $num_tests;
use Test::HasVersion;
pm_version_ok($file1);
pm_version_ok($file2);
Obviously, you can't plan twice.
use Test::More;
use Test::HasVersion;
plan tests => $num_tests;
pm_version_ok($file);
"plan" comes from "Test::More".
use Test::More;
use Test::HasVersion;
plan 'no_plan';
pm_version_ok($file);
"no_plan" is ok either.
SEE ALSO
Test::Version
Please reports bugs via CPAN RT, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-HasVersion
AUTHOR
A. R. Ferreira, <ferreira@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by A. R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.0 2006-10-07 HasVersion(3pm)