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
I have 2 files and I want to print the records which are common to both.
How can I set the default rwx permission to all users on every file which is created in the current shell?
Given a file find the count of lines containing the word "abc".
How to print all the arguments provided to the script?
What language is shell scripting?
Is it possible to substitute "ls" command in the place of "echo" command?
How important is shell scripting?
What language is used in terminal?
Is shell scripting useful?
Why should we use shell scripts?
What language is bash written in?
What are the four fundamental components of every file system on linux?
How many fields are present in a crontab file and what does each field specify?
Write down the syntax of "for " loop
what is info area how many types?