Help with appending random sequence to huge CDR file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with appending random sequence to huge CDR file
# 15  
Old 04-07-2014
Their names, I mean. How can I tell the files you want?
# 16  
Old 04-07-2014
For getting all files in folder , cant we use

cd /dupgprs/data/
for file in `ls -ltr |head -6000 |awk '{print $9}'`

It's not my brain, its some existing code for merging files. instead of 6000, if we use 1, will it work. I tried though, but the entire script doesnt give the needed result.

---------- Post updated at 04:51 PM ---------- Previous update was at 04:50 PM ----------

filename, I can put in like consolidated00[n] , where n is 1,2,3 etc. I have flexibility on file names
# 17  
Old 04-07-2014
Quote:
Originally Posted by shiburnair
For getting all files in folder , cant we use

cd /dupgprs/data/
for file in `ls -ltr |head -6000 |awk '{print $9}'`
Can we? That's the question. Do the folders contain only files you want changed? Or do they have anything you want left alone?

And why stop at 6000?
# 18  
Old 04-07-2014
the folder will only contain what i need to change. nothing else
# 19  
Old 04-07-2014
I wish you had showed me, rather than described, the changes you made... Now I have to guess where you put the space.

Code:
find /dupgprs/data/ -type f |
        grep -v "\.out" | # Ignore previously parsed files
        xargs awk 'BEGIN { getline FNUM < "/tmp/FNUM"; close("/tmp/FNUM"); }
END   { printf("%d\n", FNUM) > "/tmp/FNUM";     }
FNR==1{ FNUM++; }
{ printf("%s|0| | | | | | | |%08d%08d |\n", FNUM, FNR) > FILENAME".out"; }'

The BEGIN { } and END {} code are to load/store the file number in /tmp/FNUM, so it gets saved and loaded between different calls of awk. (of which there will likely be several, to accomodate several thousand files.)

Use nawk on solaris.
# 20  
Old 04-07-2014
let me try
# 21  
Old 04-07-2014
If you get 'too many open files', try this:

Code:
find /dupgprs/data/ -type f |
        grep -v "\.out" | # Ignore previously parsed files
        xargs awk 'BEGIN { getline FNUM < "/tmp/FNUM"; close("/tmp/FNUM"); }
END   { printf("%d\n", FNUM) > "/tmp/FNUM";     }
FNR==1{ FNUM++; if(LF) close(LF); LF=FILENAME ".out" }
{ printf("%s|0| | | | | | | |%08d%08d |\n", FNUM, FNR) > LF; }'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. BSD

Mcookie, pkg -l to generate random sequence

I am setting this thread to this bsd forum, though it may fit into bash. But as using bsd and the terminal, I would like to generate a random sequence of alphanumerical digits, such as I use to do so on linux by typing just mcookiethis one gives me a pretty random password, but it does not on bsd... (0 Replies)
Discussion started by: 1in10
0 Replies

2. Shell Programming and Scripting

Appending sequence number at the end of file name

hi team, i need a script for renaming a file with sequence number. script get a file from one directory'/home/billing/Cmm/sms/sms_tmp' append sequence no at the end of file name and move a file to other directory/home/billing/Cmm/sms/. actual file is cdr201508271527 file after renaming ... (3 Replies)
Discussion started by: mfaizan40
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. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

5. Shell Programming and Scripting

CDR manupulation

Hello Friends, I need to examine a huge CDR file according to a complex (at least for me) condition like below and i couldnt write anything :( In CDR file there are more than hundreds of fields, I need to print the rows which matches the below condition: while $13 field of subsequent... (9 Replies)
Discussion started by: EAGL€
9 Replies

6. UNIX for Dummies Questions & Answers

Adding a running sequence number while appending 2 files

Hi, I have to append 2 files and while appending i need to add a running sequence number (counter ) for each line at the first column. For e.g. If file x contains details as below. Tom Dick Harry Charlie and file y contains Boston Newyork LA Toledo Then the new file should... (1 Reply)
Discussion started by: kalyansid
1 Replies

7. Shell Programming and Scripting

parsing large CDR XML file

Dear Freind in the file attached how parse the data to be like a normal table :D (3 Replies)
Discussion started by: saifsafaa
3 Replies

8. UNIX for Dummies Questions & Answers

how can i isolate the random sequence of numbers using awk?

as you can see there is a delimiter after c8 "::". Awk sees the rest as fields because it doesn't recognize spaces and tabs as delimiters. So i am basically looking to isolate 20030003ba13f6cc. Can anyone help? c8::20030003ba13f6cc disk connected configured unknown (2 Replies)
Discussion started by: rcon1
2 Replies

9. UNIX for Dummies Questions & Answers

Generating a CDR file using PHP scripts.

Hi, I need to do croning in PHP to generate a CDR (Call Details Record) file daily from the mysql database. The CDR file has to be named in a certain sequence such as xx00000xxx200604080850.cdr. A new file is written every day. The generated CDR file is then ftp over to a server. I am... (0 Replies)
Discussion started by: kurl
0 Replies

10. Filesystems, Disks and Memory

writing to a cdr drive.

ive looked around for software to do this in linux, but am still not sure how to. i want to be able to mount a cdr and write to it and be able to take the disk out and finish writing whatever i want to it at a later time. can we do this in linux? (4 Replies)
Discussion started by: norsk hedensk
4 Replies
Login or Register to Ask a Question