how to separate the even and odd number generated from one
file to two separate file i.e. even numbers in file1.txt and
odd numbers in file2.txt
Answer Posted / roshini
echo enter filename
read file
for n in `cat $file`
do
i=`expr $n % 2`
if [ $i -eq 0 ]
then
echo $n>>even.txt
else
echo $n>>odd.txt
fi
done
| Is This Answer Correct ? | 19 Yes | 4 No |
Post New Answer View All Answers
Is shell and terminal the same?
how to get part of string variable with echo command only?
How do I run a shell script on a mac?
How do you create a shortcut in linux?
Explain about sourcing commands?
What is bash coding?
What is the crontab?
How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?
What is the syntax of while loop in shell scripting?
Explain about gui scripting?
How to use arguments in a script?
What exactly is a shell?
What is shell company all about?
I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?
Is bash a shell script?