01-20-2008
Change All File Names in a Directory
Hi,
If I have a directory full of say 100 random files, and I would like to organize them, for example: FILE001, FILE002, FILE003, FILE004, etc.
How would I do this from Terminal, instead of manually changing each file? I'm using Mac OS X, if that makes a difference.
Thank you in advance for any help
![Smilie Smilie](https://www.unix.com/images/smilies/smile.gif)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I need to replace automatically all special characters of one filename with some corresponding characters
For example >
ö --> oe
ä --> ae
....
If the special character comes more than one time, then all the coccuerences have to be replaced.
I would like to have a... (6 Replies)
Discussion started by: MAKY
6 Replies
2. Shell Programming and Scripting
Sun Solaris Unix Question
Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies
3. Shell Programming and Scripting
Hello,
I have some files in a directory like:
01_07_2010_aa.txt
01_07_2010_bb.txt
01_07_2010_cc.txt
01_07_2010_dd.txt
01_07_2010_ee.txt
01_07_2010_ff.txt
I want to change their names to :
3nm_aa.txt
3nm_bb.txt
3nm_cc.txt
3nm_dd.txt
3nm_ee.txt
3nm_ff.txt (8 Replies)
Discussion started by: ad23
8 Replies
4. Shell Programming and Scripting
got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies
5. Shell Programming and Scripting
Hi is it possible to change multiple files (~10k) names with out disturbing the data in it. ?
input
Hynda|cgr10(+):100027702-1000312480|.txt
Hynda|cgr10(+):100027702-1000312483|.txt
Hynda|cgr10(+):100027702-1000312484|.txt
Hynda|cgr10(+):100027702-1000312482|.txt
output... (4 Replies)
Discussion started by: quincyjones
4 Replies
6. Red Hat
admin.campaign.sql
admin.cardnumber_filter.sql
understand that rename is using mv command but how do I rename such that it become the following:
campaign.sql
cardnumber_filter.sql
thanks (2 Replies)
Discussion started by: jediwannabe
2 Replies
7. UNIX for Dummies Questions & Answers
I have fasta files with multiple sequences in each. I need to change the sequence name headers from:
>accD:_59176-60699
ATGGAAAAGTGGAGGATTTATTCGTTTCAGAAGGAGTTCGAACGCA
>atpA_(reverse_strand):_showing_revcomp_of_10525-12048
ATGGTAACCATTCAAGCCGACGAAATTAGTAATCTTATCCGGGAAC... (2 Replies)
Discussion started by: tyrianthinae
2 Replies
8. Shell Programming and Scripting
Hi,
How can I change following file name in a bash script?
From file names: myfile-module-1.0-3.0.el6.x86_64.package
To file names: myfile-module1_0-1.0-3.0.el6.x86_64.package
^ ^ ^ ^ ^ ^ ^ ^
Basically, the digit 1.0 is a version number, the digit 3.0 is... (11 Replies)
Discussion started by: hce
11 Replies
9. Shell Programming and Scripting
Hi,
I have a files in a directory as below :-
ls -1
mqdepth-S1STC02
proc-mq-S1STC01
proc-mq-S1STC02
proc-mq-S1STC03
Whereever i have S1STC i need to copy them into new file with file name S2STC.
expected output :-
ls -1
mqdepth-S2STC02
proc-mq-S2STC01
proc-mq-S2STC02... (3 Replies)
Discussion started by: satishmallidi
3 Replies
10. Shell Programming and Scripting
I have a landing directory on my unix (solaris) server, that receives the following files:
MLH4301I AAOT-hhslog.610.20150805.txt
MLH4301I AAOT-hhslog.611.20150805.txt
MLH4301I AAOT-hhslog.612.20150805.txt
MLH4301I AAOT-hhslog.613.20150805.txt
and I need to add to this files the number 10000... (6 Replies)
Discussion started by: fretagi
6 Replies
LEARN ABOUT ULTRIX
initstate
random(3) Library Functions Manual random(3)
Name
random, srandom, initstate, setstate - better random number generator; routines for changing generators
Syntax
long random()
void srandom(seed)
int seed;
char *initstate(seed, state, n)
unsigned seed;
char *state;
int n;
char *setstate(state)
char *state;
Description
The subroutine uses a non-linear additive feedback random number generator employing a default table of size 31 long integers to return
successive pseudo-random numbers in the range from 0 to (2**31)-1. The period of this random number generator is very large, approximately
16*((2**31)-1).
The subroutines have (almost) the same calling sequence and initialization properties as The difference is that rand(3) produces a much
less random sequence - in fact, the low dozen bits generated by rand go through a cyclic pattern. All the bits generated by are usable.
For example, "random()&01" will produce a random binary value.
Unlike does not return the old seed; the reason for this is that the amount of state information used is much more than a single word.
(Two other routines are provided to deal with restarting/changing random number generators.) Like however, will by default produce a
sequence of numbers that can be duplicated by calling with 1 as the seed.
The routine allows a state array, passed in as an argument, to be initialized for future use. The size of the state array (in bytes) is
used by to decide how sophisticated a random number generator it should use - the more state, the better the random numbers will be. (Cur-
rent "optimal" values for the amount of state information are 8, 32, 64, 128, and 256 bytes; other amounts will be rounded down to the
nearest known amount. Using less than 8 bytes will cause an error). The seed for the initialization (which specifies a starting point for
the random number sequence, and provides for restarting at the same point) is also an argument. returns a pointer to the previous state
information array.
Once a state has been initialized, the routine provides for rapid switching between states. The subroutine returns a pointer to the previ-
ous state array; its argument state array is used for further random number generation until the next call to or
Once a state array has been initialized, it may be restarted at a different point either by calling (with the desired seed, the state
array, and its size) or by calling both (with the state array) and (with the desired seed). The advantage of calling both and is that the
size of the state array does not have to be remembered after it is initialized.
With 256 bytes of state information, the period of the random number generator is greater than 269, which should be sufficient for most
purposes.
Diagnostics
If is called with less than 8 bytes of state information, or if detects that the state information has been garbled, error messages are
printed on the standard error output.
See Also
rand(3)
random(3)