I am in a terrible emergency. I have multiple cdr files with line count >6000.
I need to append |0| | | | | | | |random| to end of each line. The random number should never repeat.
Please help with a shell script to process all cdr's in a directory with above requirement.
---------- Post updated at 04:34 PM ---------- Previous update was at 04:31 PM ----------
sample cdr format : i need to append to the end of each line like below mentioned extra columns and a random no followed by |. so as to make each cdr undoubtedly unique
Looks perfect friend, Just please tell me, how to pick all files in a dir and do above appending. I am asking for this because, I have to deal with exact 45-50 files with 60k cdr's in each file.
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
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.)