Need to dynamically create a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to dynamically create a file
# 8  
Old 12-03-2004
Quote:
Originally posted by seg
No need to get bent out of shape.
Calling into question people's intent usually puts them on the defensive. Had you just said "I don't know" I would have had zero problems.

Next time think before you hit submit.
# 9  
Old 12-03-2004
You seem to be taking this rather personally. Have you been struggling with this issue for a while? Do you think you might benefit from a break for a chance to look at it from a fresh perspective?
# 10  
Old 12-03-2004
Quote:
Originally posted by seg
You seem to be taking this rather personally. Have you been struggling with this issue for a while? Do you think you might benefit from a break for a chance to look at it from a fresh perspective?
What I would benefit from is people helping me solve this problem instead of calling to question my intent, then wondering why I'm being defensive. If you can't understand that, then I have neither the patienct nor the energy to explain it to you.

Either you wish to help me or you don't. If you wish to help, great! Otherwise, move on.
# 11  
Old 12-03-2004
Quote:
Originally posted by Perderabo
cat /bin/* | dd

or something like that.
Unfortunately, that didn't generate a file large enough, but it does give me some other ideas.

Thanks Perderabo.
# 12  
Old 12-03-2004
Here is the idea i have ....

1)create a junk file having varying lines of lengths of data ....

2)put a while loop for number of files u want ...
if u want 100 files repeat the loop 100 time

get the random number using the following

3)x=`expr $RANDOM % 1000`


4) Using this random number 'x' get the xth line from junk file
put it in the randomfile using date upto seconds
since time changes for evry sec ... u will have 60 diff files in a minute.


d=`date +%T`
5) echo "xth line" > $d.dat

6).use sleep if u want ....

Hope this is not junk idea !! Smilie Smilie
# 13  
Old 12-03-2004
He is using csh so no RANDOM variable is maintained by the shell.
# 14  
Old 12-04-2004
Firstly, I don't use csh (I use bourne variants), so your milage may well vary. Also; I don't know whether the lack of /dev/(u)random will effect the ability of awk to generate random numbers?

awk -vu=$upper 'BEGIN {
srand();
printf( "%0.0f\n", rand() * u );
}'

There are lots of other ideas in a script over at shelldorado although all but one seem to depend on either some kind of device file (random or urandom), or a RANDOM shell builtin.

Some kind of date manipulation may be your only option.

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split file Dynamically

Hello , I have a flat file ( comma separated ) and want to split dynamically . If I provide input 3 then rows 1,4,7 will o/p to a file and rows 2,5,8 will redirect to 2nd file and 3,6,9 rows will go to 3rd file So 3 files will be generated . Could it be possible in Unix? (2 Replies)
Discussion started by: Pratik4891
2 Replies

2. Shell Programming and Scripting

Dynamically creating file names from portions of another file name

Not sure how to do the following, but any help would be appreciated. Has to be done using C shell (sorry about that). I have about 300 files that I need this done for, but I am only going to give one example. I will just need to know how to execute your solution through some type of loop to get... (2 Replies)
Discussion started by: jclanc8
2 Replies

3. Shell Programming and Scripting

Shell Script to Dynamically Extract file content based on Parameters from a pdf file

Hi Guru's, I am new to shell scripting. I have a unique requirement: The system generates a single pdf(/tmp/ABC.pdf) file with Invoices for Multiple Customers, the format is something like this: Page1 >> Customer 1 >>Invoice1 + invoice 2 >> Page1 end Page2 >> Customer 2 >>Invoice 3 + Invoice 4... (3 Replies)
Discussion started by: DIps
3 Replies

4. Shell Programming and Scripting

Dynamically parse BibTeX and create hash of hash

Hello gurus, Iam trying to parse following BibTex file (bibliography.bib): @book{Lee2000a, abstract = {Abstract goes here}, author = {Lee, Wenke and Stolfo, Salvatore J}, title = {{Data mining approaches for intrusion detection}}, year = {2000} } @article{Forrest1996, abstract =... (0 Replies)
Discussion started by: wakatana
0 Replies

5. Shell Programming and Scripting

How to create dynamically associative array in PHP?

Hi, I have an html page like this: <html> <body> <form action="test.php" method = "post"> Enter your name:<input name="search" type = "text" size ="40"> <br> Enter your age:<input name="age" type = "text" size ="20"> <input type = "submit" name="submit" value="search"> <input type =... (1 Reply)
Discussion started by: vanitham
1 Replies

6. Shell Programming and Scripting

How to dynamically create user name in perl and move the files?

Hi, I have two problems in which i have stuck up. a) To move the files and copy back. b) To create user dynamically. Question 1: I have to move the files to some other directory and copy it when all the process is done. I have the code like this: $file = "/home/data/file1.txt";... (2 Replies)
Discussion started by: vanitham
2 Replies

7. Shell Programming and Scripting

how to create the files dynamically in c shell script

how can i CREATE a txt file dynamically in c shell: for instance: #! /bin/csh for each i (*) cat>file$i.txt for each j do .... (1 Reply)
Discussion started by: jdsignature88
1 Replies

8. Shell Programming and Scripting

How to create hash dynamically in perl?

Hi, I have one file name file.txt It has the following contents: #File Contents StartTime,EndTime,COUNTER1,COUNTER2,COUNTER3 12:13,12:14,0,1,0 The output should be like this: StartTime: 12:13 ENDTIME: 12:14 (2 Replies)
Discussion started by: vanitham
2 Replies

9. Shell Programming and Scripting

Dynamically create arrays

I have a bash challenge. I have several virtualization hosts for which I need to collect VM information. I need to dynamically create an array for each host. The contents of the array should be the list VMs running on the host. Here's the logic; I just need someone to help me with the details:... (0 Replies)
Discussion started by: EdgarTorres
0 Replies

10. Shell Programming and Scripting

Dynamically locating a file

Hi, I have a requriement where in I need to install a s/w by executing the installable file through a script. The script currently contains the path of the installable file. I need to now update the script accordingly such tht it identifies the location of the installable file automatically and... (1 Reply)
Discussion started by: yoursdavinder
1 Replies
Login or Register to Ask a Question