05-20-2008
Your program is linear, not a loop
You read input four times. Each time, storing to the same variable name.
Then, you check on its status.
Print a 1 as count variable
add 1 to count
print out count again
Thus, the program is executing exactly as you wrote it.
You want to:
--store each variable to a distinct name
--loop through the variables when done (not a one-time if)
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I am trying to attach tape drive to sun V890 running Solaris 9 on it.
I have installed HBA(qlogic) in slot 1 of 0-8 slots and booted the system. I do not see HBAin prtdiag output. The tape drive is not attached to HBA. The tape drive I am going to attach is Sony AIT3.
1.How can I make... (3 Replies)
Discussion started by: sriny
3 Replies
2. Shell Programming and Scripting
I have a simple script that I want to notify me whenever there are anything other than one instance of a particular process running. I've always used the script:
DPID_DW=$(ps -ef | grep | wc -l)
if
then
echo "The data warehouse manager for DB is down"
elif
then
... (4 Replies)
Discussion started by: heprox
4 Replies
3. Shell Programming and Scripting
Hi,
I want to count how many rows are in a file for a specific column.
eg.
K NM
K NM
K NM
K JK
K NM
K JK
K NM
so the file is tab-delimited. I want to count how many rows are in column 2 and how many NMs there are.
I used awk
awk '{OFS="\t"}; {count++} {print i,... (3 Replies)
Discussion started by: phil_heath
3 Replies
4. UNIX for Dummies Questions & Answers
if i have a long list of data, with every line beginning with an ip-address, like this:
62.165.8.187 - - "GET /bestandnaam.html HTTP/1.1" 200 5848 "http://www.domeinnaam.nl/bestandnaam.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
how do i count which ip-adresses are mentioned... (3 Replies)
Discussion started by: FOBoy
3 Replies
5. Shell Programming and Scripting
Hi All,
I need some help in counting the number of letters in a big file with separations.
Following is the file I have
>AB_1
MLKKPIIIGVTGGSGGGKTSVSRAILDSFPNARIAMIQHDSYYKDQSHMSFEERVKTNYDHPLAFDTDFM
IQQLKELLAGRPVDIPIYDYKKHTRSNTTFRQDPQDVIIVEGILVLEDERLRDLMDIKLFVDTDDDIRII... (6 Replies)
Discussion started by: Lucky Ali
6 Replies
6. Shell Programming and Scripting
Hi,
The following output shows how many pmon process are started by users named : oracle or yoavb
$ ps -ef |grep pmon |grep -v grep |grep -v ipmon
oracle 11268 1 0 Sep 2 ? 36:00 ora_pmon_qerp
oracle 17496 1 0 Oct 11 ? 8:58 ora_pmon_bcv
oracle 15081 1 0 ... (5 Replies)
Discussion started by: yoavbe
5 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
I promise this is my very last dumb question.. but how to you count how many unique names you have.
My dataset is:
>Bac1
afdsgrr
>Bac4
egege
>Bac8
dgrjh
>Bac1
afdsgrr
>Bac1
afdsgrr
>Bac8
dgrjh
What i want to know is that how many unique names there is, so the output would... (3 Replies)
Discussion started by: Iifa
3 Replies
8. Shell Programming and Scripting
how to count how many R in the below file.
Rttt
1Rxxx
GG
2R
3R
4R
5R
6R
7R
R0
R1
R2
R3
R4
R5
R6
R7
RR (10 Replies)
Discussion started by: theshashi
10 Replies
9. Shell Programming and Scripting
I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies