Wow, some of the above examples defy simplicity to the nth+1 degree.
The trouble I have difficulty with is "finding median with an if statement". BASH doesn't deal with floating point, so I'm not sure how to accomplish this. We could use sort but that would obviate the need for an if clause. We could iteratively throw away the highest and lowest values, but that's a lot of work (computationally).
Last edited by otheus; 01-21-2011 at 08:49 PM..
Reason: major syntax errores
I am trying to change this :
Albert Einstein 52
Peter Scott 22
Hilary Smith 48
Joan Bakewell 30
Catherine Maguire 26
into
Albert Einstein Pass
Peter Scott Fail
Hilary Smith Pass
Joan Bakewell Fail
Catherine Maguire Fail
I have to use a if statement that says:
if field 3 is... (2 Replies)
I had different problem scenarios with IF statement. Can any expert please enlighten me on the difference with these scenarios. Thank you.
1st Scenario:
testdate=`date +%Y%m`
test=`cat /var/log/database0.$testdate*.log | grep "Errors found during processing" | tail -10`
if
then
... (4 Replies)
This is for a program I have to do to calculate the day of the week.
I need to write an if statement that will do the following:
if day is 29 and year is odd, don't calculate dayif ( day == 29 && year == ??? )I know how to do it for the day but I don't know how to do it for the year. (4 Replies)
I am kind of new in Unix and i have to make a menu. I want to put an if statement in the menu. you should enter the filename and it goes to that file. How do i do this? (1 Reply)
Good morning all!
I want to know if Im interpreting this if statement below right.
if(((1) || (0)) && (1)){
do stuff;
}
This is saying: if true piped into false, then true, then do stuff. Right?
What does the && stand for?
thanks in advance!
ben (3 Replies)
I am writing a script that does a search for a argument in a file and lists all like occurrences. The script verifies that it is a file and then runs another script that list the lines. My problem is that I need the script to accept a file or a directory and then go to that directory check all... (1 Reply)
Hi
I am very new to Unix programming and shell scripting. I am trying t figure out how to write a little script that will output the number of directories. I can find the number of directories using ls -l | grep "^d" | wc -l I can not figure out how to do it so when I type the name... (8 Replies)
Hi guys,
Two problems I need solving please. I created a script where the user types in 7 numbers as standard input and each one is then stored in an array. Now I need to perform the following calculations on those numbers:
1) Use a while loop to determine the largest number in the range.
... (2 Replies)
I came across a bash script that outputs the forecast for the day and the max temperature but at the end of the day the max temperature disappears ($6) and I am left with "°C" after the forecast.
Here is the script:
#! /bin/bash
curl -s --connect-timeout 30... (7 Replies)
Discussion started by: _light_
7 Replies
LEARN ABOUT ULTRIX
pnmhistmap
pnmhistmap(1) General Commands Manual pnmhistmap(1)NAME
pnmhistmap - draw a histogram for a PGM or PPM file
SYNOPSIS
pnmhistmap [-black] [-white] [-max N] [-verbose] [pnmfile]
DESCRIPTION
Reads a portable anymap as input, although bitmap (PBM) input produces an error message and no image. Produces an image showing a his-
togram of the color (or gray) values in the input. A graymap (PGM) input produces a bitmap output. A pixmap (PPM) input produces pixmap
output with three overlaid histograms: a red one for the red input, a green one for the green input, and a blue one for the blue input.
The output is fixed in size: 256 pixels wide by 200 pixels high.
OPTIONS -black Ignores the count of black pixels when scaling the histogram.
-white Ignores the count of white pixels when scaling the histogram.
The -black and -white options, which can be used seperately or together, are useful for images with a large percentage of pixels whose
value is zero or 255, which can cause the remaining histogram data to become unreadbaly small. Note that, for pixmap inputs, these options
apply to all colors; if, for example, the input has a large number of bright-red areas, you will probably want to use the -white option.
-max N Force the scaling of the histogram to use N as the largest-count value. This is useful for inputs with a large percentage of sin-
gle-color pixels which are not black or white.
-verbose
Report the progress of making the histogram, including the largest-count value used to scale the output.
All flags can be abbreviated to their shortest unique prefix.
BUGS
Assumes maxval is always 255. Images with a smaller maxval will only use the lower-value side of the histogram. This can be overcome
either by piping the input through "pnmdepth 255" or by cutting and scaling the lower-value side of the histogram. Neither is a particu-
larly elegant solution.
Should allow the output size to be specified.
SEE ALSO pgmhist(1), ppmhist(1), pgm(5), ppm(5)AUTHOR
Wilson H. Bent. Jr. (whb@usc.edu).
25 October 1993 pnmhistmap(1)