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

write a shell script to identify the given string is palindrome or not?

17 Answers   CTS, HP, IBM, InfoEst, Wipro,


Determine the output of the following command: [ -z “” ] && echo 0 || echo 1

0 Answers  


How to print some text on to the screen?

2 Answers  


what do u mean by $#,$* in unix programming?

5 Answers   Convergys, TCS,


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

4 Answers   Amazon,






In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

0 Answers  


What are the various stages of a linux process it passes through?

0 Answers  


What are the 4 basics of OOP?

1 Answers   Amazon, Infosys,


Explain about shebang?

0 Answers  


If one dont know how to create a script then how he/she can use the QTP?

1 Answers  


How to print pid of the current shell?

0 Answers  


Write a command sequence to find all the files modified in less than 2 days and print the record count of each.

0 Answers  


Categories