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 a part of kernel?
What are the disadvantages of shell scripting?
How to check if a directory exists?
How do I save a powershell script?
Can shell script run on windows?
What is difference between bash and shell?
What is the use of a shebang line?
What is bash used for?
Why do we write bin bash in shell scripts?
What is bash coding?
How to print all the arguments provided to the script?
Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?
What is bash command used for?
What is bash shell command?
Is bash a shell script?