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
How can you get the value of pi till a 100 decimal places?
What are the advantages of shell script?
What is difference between bash and shell?
Why is used in shell scripting?
What is awk in shell script?
What is option in shell script?
What are the different variables present in linux shell?
How many fields are present in a crontab file and what does each field specify?
How do I run a powershell script?
Is shell scripting easy to learn?
c program to display the information of given file similar to givan by the unix or linux command ls -l
How are shells born?
What is shell and terminal?
What is the use of "$#" in shell scripting?
i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..