ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Scripts  >>  Shell Script
 
 


 

 
 PHP interview questions  PHP Interview Questions
 ASP interview questions  ASP Interview Questions
 CGI Perl interview questions  CGI Perl Interview Questions
 JavaScript interview questions  JavaScript Interview Questions
 VB Script interview questions  VB Script Interview Questions
 JSP interview questions  JSP Interview Questions
 Shell Script interview questions  Shell Script Interview Questions
 Python interview questions  Python Interview Questions
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 AJAX interview questions  AJAX Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
 Scripts AllOther interview questions  Scripts AllOther Interview Questions
Question
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
 Question Submitted By :: Praveen
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
Answer
# 1
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 1 No
Amol
 

 
 
 
Other Shell Script Interview Questions
 
  Question Asked @ Answers
 
why did you apply to shell Shell1
Why we are writting shell scripts? Plz if possible explain it briefly. ITC-Infotech4
What is INODE?  1
how to create purchase order  1
What is the use of script interpreter in shell scripting?  2
what are special characters and explain how does text varies by the usage of single quotes,double quotes and back quotes?  1
How to enable the shell to know what program should be run to interpret the script?  3
What are the additional egrep symbols?  1
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"  4
How do you print the output the same string which is typed in command line. how do you write the shell script or command for this. if i entered "Hello" in command line, it should print 'Hello', if i say "Hello Welcome", i should get the "Hello Welcome" as output.? Symphony1
write a shell script to identify the given string is palindrome or not? IBM3
What are the Different types of shells?  1
write a shell script that counts a number of unique word contained in the file and print them in alphabetical order line by line? Wipro1
What is the difference between a variable and value? Sun-Microsystems1
Write a shell script to looking at the log file to see if the test has passed or not TCS1
Create a bash shell script that removes all files whose names end with a "~" from your home directory and subdirectories. Name this script "cleanup.sh"  4
How to rename all the files in a folder having specific extension? Example: I have some files with extension (.txt) in a folder name 'Test'. I have to rename all the .txt files in a test and its subdirectories to .my extension. Interra-IT6
How to customise the existing shell?  1
Is SSO and SSL support BOXI?  1
How to handle the delimiter unit seperator in Unix  1
 
For more Shell Script Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com