The information of the two files should be redirect to
Third file in such a way that, the third file contain the
information like this.

1st line in third file should be from 1st file
2nd line in Third file should be from 2nd file
3rd line in Third file should be from 1st file
4th line in Third file should be from 2nd file
-
- so on

Answers were Sorted based on User's Feedback



The information of the two files should be redirect to Third file in such a way that, the third fi..

Answer / karthik c n

paste -d"\n" file1 file2 > file3

Is This Answer Correct ?    9 Yes 0 No

The information of the two files should be redirect to Third file in such a way that, the third fi..

Answer / amol

Unix utility sed can be used serve the purpose
Assuming file1.txt and file2.txt are two input files and
file3.txt is the third file.

Contents of the file1.txt
line 1
line 2
line 3

Contents of the file2.txt
LINE 1
LINE 2
LINE 3


After executing below mentioned command

sed -n -e '{
> R file2.txt
> p
> }' file1.txt > file3.txt


The third file file3.txt will be
line 1
LINE 1
line 2
LINE 2
line 3
LINE 3

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More Shell Script Interview Questions

What are filters explain sort with all the options available?

1 Answers  


How Connect to a Database in Shell Programming?

4 Answers   Syntel,


how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?

1 Answers  


wats the she bang statment with syntax?

3 Answers  


What is shell environment?

1 Answers  


How to change our default shell?

5 Answers  


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

4 Answers   Infosys,


how to search for vowels a,e,i,o,u appearing in the same sequence in a file

4 Answers   Amazon,


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

1 Answers  


Create a bash shell script to sort and then uniq the file from the command line & store it to a new file and output the results to the screen. Name this script "sortAndUniq.sh"

5 Answers  


Explain about "s" permission bit in a file?

1 Answers  


What is the command for " how many shell is running in your system or how many shell supported by your system " ?.

3 Answers  


Categories