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 / jaya prasad

echo "Enter the file name"
read file
awk '$NF % 2 == 0' $file > file1.txt
awk '$NF % 2 != 0' $file > file2.txt

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of variables used in shell script?

557


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 ?

1720


How do I stop script errors?

578


Explain about return code?

636


What are the zombie processes?

568






How do I run a shell script in powershell?

556


What lives in a shell?

543


Why is a script important?

566


How to calculate the number of passed arguments?

558


Is shell scripting easy to learn?

571


How can I set the default rwx permission to all users on every file which is created in the current shell?

912


What is a shell script in windows?

590


What is sh in shell script?

577


What does $1 mean in bash?

618


What is shell geeksforgeeks?

600