Computing.Net > Forums > Unix > Unix shell Programming

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Unix shell Programming

Reply to Message Icon

Name: mau
Date: May 15, 2002 at 01:05:54 Pacific
Comment:

Can u pls tell me
how to write a shell script
To remove from an ordered array all the numbers that occurs more than once



Sponsored Link
Ads by Google

Response Number 1
Name: den
Date: May 15, 2002 at 14:34:27 Pacific
Reply:

hi mau,

can i have a sample of your file




0

Response Number 2
Name: den
Date: May 15, 2002 at 15:28:11 Pacific
Reply:


mau,

try this script....

> output.txt
cat file | while read den
do
grep -w ${den} file > /dev/null
if test $? -ne 0
then

echo ${den} >> output.txt
fi
done



0

Response Number 3
Name: Hemant Choudhary
Date: May 18, 2002 at 20:37:06 Pacific
Reply:

Hi mau
I am also doing MCA from Ignou. I could solve the problem that you have posted on this site. Here is the solution. You can ask me any problem in shell scripting or in C programing.

---------

clear
echo "Enter size of the array"
read arsz
i=1
while [ $i -le $arsz ]
do
read x$i
let i=i+1
done

i=1
let m=arsz-1
while [ $i -le $m ]
do
eval a=\$x$i
let j=i+1
while [ $j -le $arsz ]
do
eval b=\$x$j
if [ $a = $b ]
then
eval x$j=0
fi
let j=j+1
done
let i=i+1
done
i=1
echo
echo
echo
echo
while [ $i -le $arsz ]
do
eval m=\$x$i
if [ $m != 0 ]
then
echo $m
fi
let i=i+1
done
echo
echo
echo
echo
echo
-------


0

Response Number 4
Name: Mr.Crackhead
Date: May 20, 2002 at 23:52:08 Pacific
Reply:

wow, your highness, u got anything for
me? i like c programming, any demos
any source code wanna share with me?

still learning c, need directions. !!!!!!


0

Response Number 5
Name: ashwin pandit
Date: July 5, 2002 at 01:41:16 Pacific
Reply:

pls. tell me where to type unix sheel program and what are the system requirements for running a sheel script


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Unix shell Programming

Unix Shell Program www.computing.net/answers/unix/unix-shell-program/4881.html

Unix Shell program www.computing.net/answers/unix/unix-shell-program/3441.html

Shell Programming www.computing.net/answers/unix/shell-programming/1017.html