Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Faster way to multiply a file Nth times? Post 302544792 by chstr_14 on Friday 5th of August 2011 03:38:13 AM
Old 08-05-2011
The perl works! Thanks to both of you Smilie
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Which is faster? Reading from file or 'ps'

Hi There... I have an application which starts up many different processes under different names and I'm creating a script to tell me which processes are running (approx 30 different processes). To do this, I parse the results of a ps -u $USER. My question is, will my script be faster if I run... (2 Replies)
Discussion started by: orno
2 Replies

2. Shell Programming and Scripting

Script to parse a file faster

My example file is as given below: conn=1 uid=oracle conn=2 uid=db2 conn=3 uid=oracle conn=4 uid=hash conn=5 uid=skher conn=6 uid=oracle conn=7 uid=mpalkar conn=8 uid=anarke conn=1 op=-1 msgId=-1 - fd=104 slot=104 LDAPS connection from 10.10.5.6 to 10.18.6.5 conn=2 op=-1 msgId=-1 -... (7 Replies)
Discussion started by: sags007_99
7 Replies

3. HP-UX

Faster command for file copy than cp ?

we have 30 GB files on our filesystem which we need to copy daily to 25 location on the same machine (but different filesystem). cp is taking 20 min to do the copy and we have 5 different thread doing the copy. so in all its taking around 2 hr and we need to reduce it. Is there any... (9 Replies)
Discussion started by: shipra_31
9 Replies

4. Shell Programming and Scripting

Using AWK to find top Nth values in Nth column

I have an awk script to find the maximum value of the 2nd column of a 2 column datafile, but I need to find the top 5 maximum values of the 2nd column. Here is the script that works for the maximum value. awk 'BEGIN { subjectmax=$1 ; max=0} $2 >= max {subjectmax=$1 ; max=$2} END {print... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

5. Shell Programming and Scripting

Calculating average for every Nth line in the Nth column

Is there an awk script that can easily perform the following operation? I have a data file that is in the format of 1944-12,5.6 1945-01,9.8 1945-02,6.7 1945-03,9.3 1945-04,5.9 1945-05,0.7 1945-06,0.0 1945-07,0.0 1945-08,0.0 1945-09,0.0 1945-10,0.2 1945-11,10.5 1945-12,22.3... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

6. Shell Programming and Scripting

Replace a value of Nth field of nth row

Using Awk, how can I achieve the following? I have set of record numbers, for which, I have to replace the nth field with some values, say spaces. Eg: Set of Records : 4,9,10,55,89,etc I have to change the 8th field of all the above set of records to spaces (10 spaces). Its a delimited... (1 Reply)
Discussion started by: deepakwins
1 Replies

7. UNIX for Dummies Questions & Answers

What is the faster way to grep from huge file?

Hi All, I am new to this forum and this is my first post. My requirement is like to optimize the time taken to grep the file with 40000 lines. There are two files FILEA(40000 lines) FILEB(40000 lines). The requirement is like this, both the file will be in the format below... (11 Replies)
Discussion started by: mad man
11 Replies

8. UNIX for Beginners Questions & Answers

Multiply values from a file

Hi All, I extracted a file using an awk command like this awk '{print substr($0,78,5)"," substr($0,59,6) "," substr($0,81,3) "," substr($0,11,7)}' file1 >> OUTPUT cat OUTPUT 00001,100000,005,0000080 00001,100000,008,0000220 00001,100000,001,0001000 00010,100000,001,0000400 I want... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
ROLLDICE(6)							   Games Manual 						       ROLLDICE(6)

NAME
rolldice - rolls virtual dice SYNOPSIS
rolldice [ options ] dice_string dice_string ... DESCRIPTION
rolldice rolls virtual dice. The dice strings passed on the command line contain information on the dice to roll in a format comparable to the format used in fantasy role playing games. OPTIONS
-h,--help returns the usage of diceroll -v,--version returns the version of diceroll -r,--random uses /dev/random for random number generating -u,--urandom uses /dev/urandom for random number generating (default) -s,--separate prints out the result of each individual die separately, as well as the operations and totals DICE STRING FORMAT
The dice string uses the following format: {#x}{#}d[#|%]{*#}{+/-#}{s#} The dice string doesn't have to be in the format that I outlined above, but this is the nicest order for me. It will try to parse any dif- ferent string containing the same sections in the best way it can, and will throw out anything that isn't one of the sections below. {#}d[#|%] This is the only required part of the string, and now really isn't even required, as it defaults to 1d6 if not found. The first number is the number of dice to roll, and the second number is the number of sides the dice have. The numbers rolled on each die are then added up and given as the result. Hence 3d6 means "roll three six-sided dice, add them together and return the result". If the first number is left out, then the number of dice defaults to 1. If the second number is not a number, but a percentage sign, then the number of sides becomes 100 (for a percentage roll). {#x} This number tells how many times to roll. For example, if you want to roll 3 6-sided dice 6 times, you would say 6x3d6. This would return six numbers, corresponding to the six different rolls. {*#} This number tells how many times to multiply the result of each roll. 3d6*100 would return a number in the range of 300-1800, since 3-18 is the range resulting from 3d6, which is then multipled by 100. {+/-#} This number is the modifier to be added or subtracted, depending on the sign, from each roll. 1d4+1 would result in a range from 2-5 (1-4 for the die, plus 1). This step is handled *after* the multiplication modifier. {s#} This number tells the program to drop the # lowest dice rolls. This step is handled *before* the multiplication modifier. in the order show above. For an extreme example, "3x4d6*5+1s2" would roll four six-sided dice, drop the lowest two, multiply the result by 5, add 1 to that, and repeat the process two more times, for a total of three results. DIAGNOSTICS
The following error messages may appear on STDERR: Failure in getting dice attributes Either memory could not be allocated while parsing the string passed to the rolldice program or an invalid dice string was entered. Failure in rolling dice Memory could not be allocated while actually rolling the dice. Unknown option Take a wild guess ;) BUGS
I haven't noticed any yet... rolldice is a quick hack to provide a virtual dice roller for FRPGs that I play. Any improvements are greatly welcome, as I am not the most experienced C coder... AUTHOR
Stevie Strickland <sstrickl@cc.gatech.edu> VERSION
1.10 - 25 Nov 2001 Linux 25 Nov 2001 ROLLDICE(6)
All times are GMT -4. The time now is 12:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy