Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is shell and terminal the same?

1074


how to get part of string variable with echo command only?

1036


How do I run a shell script on a mac?

1135


How do you create a shortcut in linux?

1217


Explain about sourcing commands?

1109


What is bash coding?

932


What is the crontab?

1097


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?

1112


What is the syntax of while loop in shell scripting?

1056


Explain about gui scripting?

1107


How to use arguments in a script?

1119


What exactly is a shell?

1093


What is shell company all about?

997


I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?

2184


Is bash a shell script?

1073