random select text file ranamed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting random select text file ranamed
# 1  
Old 04-23-2009
random select text file ranamed

i want to need script..



source.txt
/home/user1/public_html/test3
/home/user90/public_html/test9
.
.
.
/home/user650/public_html/test000




read source.txt and cd /home/user**/public_html/***
and there is 1.txt, 2txt ~~25.txt
and select 6 text files randomly among the 1.txt ,2.txt ~~ 25.txt
selected 6 text files be renamed word1.words , word2.words ~~ word6.words in this pattern..
# 2  
Old 04-27-2009
Your question is difficult to answer, especially because it is not clear what you are asking. What is to be done with "source.txt"?

You want to randomly rename files in user's home directories? That sounds like malware.
# 3  
Old 04-29-2009
source.txt


/home/user1/public_html/test3
/home/user90/public_html/test9
.
.
.
/home/user650/public_html/test000


there are a lot of directories in source.txt --->maybe 1000 home directories

these directories have 1.txt, 2txt ~~25.txt , namely has a text file.
i want to randomly select 6 text file among these 25 files.

and i also want to rename randomly selected 6 text file as words1.word ~ words6.word .
# 4  
Old 04-29-2009
Okay, so source.txt has all these lines in it, and you simply want to pick 6 random lines and change them?
# 5  
Old 04-29-2009
you simply want to pick 6 random lines and change them?

not 6random lines
read everyall lines and there is 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt ~~ 22.txt 23.txt 24.txt 25.txt file in every directories
namely about 25 files exist
and i want to randomly select 6 files among 25 files
and rename selected 6 text files as words1.word words2.word words3.word words4.word words5.word words6.word .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using grep to select specific patterns in text file?

How do I use grep to select words that start with I or O, end in box, and contain at least one letter in between them? the text file mailinfo.txt contains Inbox the Inbox Is a match box Doesn't match INBOX Outbox Outbox1 InbOX Ibox I box If the command works correctly it... (4 Replies)
Discussion started by: steezuschrist96
4 Replies

2. Shell Programming and Scripting

Select row from file and text

Hi all! I would like to solve a problem but I have no clue of how do it!I will be grateful if someone could help me! Briefly I have a big file like this: >ENSMUSG00000000204 | ENSMUST00000159637 GGCGAGGCTTACGCCATTTTACCTCAGCGAGCATTCATAAAGCTGCGAGCATTCATACAG >ENSMUSG00000000204 |... (3 Replies)
Discussion started by: giuliangiuseppe
3 Replies

3. Shell Programming and Scripting

Need to generate a file with random data. /dev/[u]random doesn't exist.

Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom. I create a named pipe then: dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024 but when I cat a file to the fifo that's 1024 random bytes: cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies

4. UNIX for Dummies Questions & Answers

How to randomly select lines from a text file

I have a text file with 1000 lines, I want to randomly select 200 lines from it and print them as output. How do I go about doing that? Thanks! (7 Replies)
Discussion started by: evelibertine
7 Replies

5. UNIX for Dummies Questions & Answers

Select text between current date and output to new txt file

Hi guys, brand new to this thread and very very new to UNIX...so go easy please! Anyway I have a file that looks like this: >>-------------------------------------------------------------------------- Date/Time/Eng. : 2012-06-22 / 00:26 / DS Reported problem : (SD) ... (5 Replies)
Discussion started by: martin0852
5 Replies

6. Shell Programming and Scripting

Grep to isolate a text file line and Awk to select a word?

I am looking at using grep to locate the line in the text file and them use awk to select a word or words out of it. I know awk needs -v to allow a variable to be used, but also needs -F to allow the break up of the sentence and allow the location of separate variables. $line = grep "1:" File |... (8 Replies)
Discussion started by: Ironguru
8 Replies

7. Shell Programming and Scripting

Read random line from a text file

I have a text file with hundreds of lines, i wish to run a script and reads a random line to pass it to another command line such as: for line in `cat file |grep random line`; do echo $line |mail my@example.com ; done thank you (6 Replies)
Discussion started by: Bashar
6 Replies

8. Shell Programming and Scripting

Random word from a flat text file

Hello, I need to take a random word from a flat text file with words in it seperated by spaces. The code I am using, always gives me the first word. Can anyone please shed some light on this. Here's my code. Thanks echo table roof ceiling jar computer monitor keyboard carpet >... (5 Replies)
Discussion started by: Freakhan
5 Replies

9. UNIX for Dummies Questions & Answers

Retrieving random numbers out of a text file

Hi one and all, I'm working on a Bash script that is designed to calculate how much IP traffic has passed through a port to determine traffic volume over a given amount of time. I've currently been able to use the netstat -s command coupled with grep to write to a file the total packets... (13 Replies)
Discussion started by: nistleloy
13 Replies

10. Shell Programming and Scripting

Perl: random select

How do I: 1. Have a list of names. JOE, JOHN, PETER, PAT. how do i get perl to randomly select any two and put them in $name1 and put the other two in $name2 ? (1 Reply)
Discussion started by: perleo
1 Replies
Login or Register to Ask a Question