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 / ganeswar bojanapu
#!/bin/bash
echo "Enter a file name"
read file
sed -n '1~2'p $file > oddlines.txt; (or) '1~2p'
sed -n '2~2'p $file > evenlines.txt (or) '2~2p'
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the first line of a shell script called?
What is in a script?
How to check if a directory exists?
Explain about the exit command?
What is the fastest scripting language?
Is shell a scripting language?
What is the first line in every perl script called?
Calculate a real number calculation directly from the terminal and not any shell script.
Explain about gui scripting?
What are the different commands available to check the disk usage?
What is the significance of the shebang line in shell scripting?
What's the difference between scripting and coding?
What are the different types of variables used in shell script?
Why should we use shell scripts?
How important is shell scripting?