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

How many fields are present in a crontab file and what does each field specify?

0 Answers  


Can we run shell script in windows?

0 Answers  


What is the difference between a shell variable that is exported and the one that is not exported?

6 Answers  


How do I read a .sh file?

0 Answers  


How does path variable work?

0 Answers  






What is another name for a bash shell script that you might see?

0 Answers  


What is the purpose of scripting?

0 Answers  


What is the difference between grep and egrep?

0 Answers  


What are scripts in psychology?

0 Answers  


c program to check whether all the directories in the path exists has read and write permission

1 Answers  


Tell something about the super block in shell scripting?

0 Answers  


What is the difference between running a script as ./scriptname.sh and sh scriptname.sh

1 Answers  


Categories