9 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hello. I'm writing an awk script that looks at a .csv file and calculates the weighted grade based on the scores and categories in the file. I keep getting a fatal division by zero attempted error and I know what it means but I've been looking over the code for awhile and am not sure what is... (4 Replies)
Discussion started by: Eric7giants
4 Replies
2. Shell Programming and Scripting
I want to implement the below formula with awk oneliner
new_value = ((old_value - old_min) / (old_max - old_min) ) * (new_max - new_min) + new_min
I want to pass the value of old_min and old_min as variable. Here is what I did for this
old_min=$(awk 'BEGIN{a=100000000000}{if ($10<0+a) a=$10}... (2 Replies)
Discussion started by: sammy777888
2 Replies
3. Shell Programming and Scripting
Hi,
Below is my input file:
Long list of significant figure
1.757E-4
7.51E-3
5.634E-5
.
.
.
Desired output file:
0.0001757
0.00751
0.00005634
.
.
. (10 Replies)
Discussion started by: perl_beginner
10 Replies
4. Shell Programming and Scripting
Hi Friends,
My input
chr1 100 200 1234E-02 0.01 0.05 10
chr1 100 200 14E-11 0.11 0.50 1
chr1 100 200 134E-22 0.00 0.65 111
My command
awk '{print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$13}' input | awk '{v=($5/$6); print $0"\t"v}' OFS="\t" | awk '{$8=(log($8)/log(2)); print $0}'... (4 Replies)
Discussion started by: jacobs.smith
4 Replies
5. Shell Programming and Scripting
when i try the snippet in the console its working fine:
ps awwwux | grep php-fpm | grep -v grep | grep -v master | awk '{total_mem = $6 * 1024 + total_mem; total_proc++} END{printf("%d\n", total_mem / total_proc)}'
output:
but when i try the bash script:
#!/bin/sh
# -*- sh -*-
#... (3 Replies)
Discussion started by: danieloooo
3 Replies
6. UNIX for Dummies Questions & Answers
I'm putting together a shell script while I'm learning UNIX -- just for myself. It's a little script that simply takes some vendor names and writes them to a file. So far I'm at the stage where the user enters the name of the file and places it in a folder called vendorlists:
* ) touch... (5 Replies)
Discussion started by: Straitsfan
5 Replies
7. Shell Programming and Scripting
Hi,
I'm executing unixbench tool v4.1 on an embedded system and I'm getting these error messages:
Execl Throughput 1 2 3awk: /unixbench/unixbench-4.1.0/pgms/loops.awk:38: (FILENAME=- FNR=4) fatal: division by zero attempted
Pipe Throughput 1 2 3 4 5 6 7 8 9 10awk:... (3 Replies)
Discussion started by: rogelio
3 Replies
8. Shell Programming and Scripting
Hi ,
I have file :
after i run this command :
there are error
can we print blank line if output error ??
thanks.. ^^ (4 Replies)
Discussion started by: justbow
4 Replies
9. UNIX for Dummies Questions & Answers
I am having problems scripting in UNIX. I am currently attending school and for the first time I am being introduced to scripting. My problem is I am supposed to enhance the spell_check by adding a third optional argument. The third argument is to specify a list of words to be added to the... (1 Reply)
Discussion started by: steph
1 Replies
PURITY(6) Games Manual PURITY(6)
NAME
purity - a general purpose purity test
SYNOPSIS
/usr/games/purity [ flags ] [ testname ]
DESCRIPTION
Purity is an interactive purity test program with a simple, user interface and datafile format. For each test, questions are printed to
the your terminal, and you are prompted for an answer to the current question. At a prompt, these are your choices:
y Answer "yes" to the question.
n Answer "no" to the question.
b Backup one question, if you answered it incorrectly, or someone is watching you take the test, and you don't (or do) want to
admit a different answer.
r Redraw the current question.
q Quit the test, and print the current score.
? Print a help screen for the current prompt.
k Kill a section of the test. This skips all the questions of the test until the next subject heading.
a Toggle answer mode between real answers and obfuscated answers. Real answers print "yes" and "no", while obfuscated answers
are "Maybe" and "maybe". Obfuscated answers are preferred if you are shy, and don't want people to be able to read your
answers over your shoulder as you take the test.
d Toggle dERanGe output.
s Print your current score on the test you are taking.
l Toggle score logging.
At the end of the test, your score is printed out. For most purity tests, lower scores denote more "experience" of the test material.
FLAGS
These are the command line flags for the test.
-a Show real answers (i.e. "yes" and "no") instead of obfuscated ones (i.e. "Maybe" and "maybe") as you answer the questions.
-d PrINt THe tESt in DerANgeD pRInT.
-f Take the test in fast mode. Only the questions are printed, and not any other text blocks, like the introdution, subject
headers, and the conclusion.
-l Take the test without having your score logged.
-p Print the test without prompting for answers. This is useful for making hard copies of the tests without having to edit out
the prompts by hand.
-r Decrypt the test using the Rot 13 algorithm. This is done as a form of "protection", such that if you read a rot13 test and
it offends you, it's your own fault.
-z zoom through more prompts in large text blocks. The default is to prompt the user for more when a screenful of text has been
printed without any user input.
DATAFILE FORMAT
The format of the datafiles is a very simple format, intended such that new tests can quickly and easily be converted to run with the test.
There are four types of text in a purity test datafile. Each type is contained in a bracket type of punctuation. The definitions are as
follows:
the styles of text blocks are:
{ plain text block }
[ subject header ]
( test question )
and < conclusion >
Plain text blocks are printed out character for character.
Subject headers are preceded by their subject numbers, starting at 1, and then printed as text blocks.
Questions are preceded by their numbers, and then prompt the user to answer the question, keeping track of the user's current score.
Conclusions first calculate and print the user's score for the test, then print out the conclusion as a text block.
If you wish to include any of the various bracket punctuation in your text, the backslash ("") character will escape the next character.
To print a question with parentheses, you would use the following format:
(have you ever written a purity test (like this one)?)
the output would be this:
1. have you ever written a purity test (like this one)?
and then it would have asked the user for her/his answer.
For a generic datafile, use the "sample" datafile for the test.
FILES
/var/games/purity.scores the score logfile
/usr/share/games/purity/* test data files
AUTHOR
Eric Lechner, lechner@ucscb.ucsc.edu
18 December 1989 PURITY(6)