Krishna Logo
qa training in canada now
Divied
Call: Anusha @ 1 (877) 864-8462

 

Latest News
Home Navigation Divied
INTERVIEW Navigation Divied UNIX INTERVIEW QUESTIONS
Showing 71 - 80 of 324 Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next
UNIX INTERVIEW QUESTIONS
 
71How To Execute A Database Stored Procedure From Shell Script?
Date Posted: 07/02/2012

    Ans:
$> SqlReturnMsg=`sqlplus -s username/password@database<<EOF
BEGIN
Proc_Your_Procedure (… your-input-parameters …);
END;
/
EXIT;
EOF`
$> echo $SqlReturnMsg

 
 
72How To Check If A File Is Zipped In UNIX?
Date Posted: 07/02/2012

Ans: In order to know the file type of a particular file use the [file] command like below:
$> file file.txt
file.txt: ASCII text
If you want to know the technical MIME type of the file, use “-i” switch.
$>file -i file.txt
file.txt: text/plain; char set=us-ascii
If the file is zipped, following will be the result
$> file –i file.zip
file.zip: application/x-zip

 
 
73How To Test If A Zip File Is Corrupted In Linux?
Date Posted: 07/02/2012

  Ans: Use “-t” switch with the inbuilt [unzip] command
$> unzip –t file.zip

 
 
74How To Unzip A File In Linux?
Date Posted: 07/02/2012

 Ans: Use inbuilt [unzip] command in Linux.
$> unzip –j file.zip

 
 
75How To Zip A File In Linux?
Date Posted: 07/02/2012

 Ans: Use inbuilt [zip] command in Linux

 
 
76How To Show The Non-printable Characters In A File?
Date Posted: 07/02/2012

   Ans: Open the file in VI editor. Go to VI command mode by pressing [Escape] and then [:]. Then type [set list]. This will show you all the non-printable characters, e.g. Ctrl-M characters (^M) etc., in the file.

 
 
77How To Replace The N-th Line In A File With A New Line In UNIX?
Date Posted: 07/02/2012

 Ans: This can be done in two steps. The first step is to remove the n-th line. And the second step is to insert a new line in n-th line position. Here we go.
Step 1: remove the n-th line
$>Sed -i'' '10 d' file.txt       # d stands for delete
Step 2: insert a new line at n-th line position
$>Sed -i'' '10 i This is the new line' file.txt     # i stands for insert

 
 
Date Posted: 07/02/2012

Ans: We know we can do it by [cut]. Like below command extracts the first field from the output of [WC –c] command $>WC -c file.txt | cut -d' ' -f1 109 But I want to introduce one more command to do this here. That is by usi...  

 
 
79How To Reverse A String In UNIX?
Date Posted: 07/02/2012

Ans: Use the [rev] command.
      $> echo "Unix" | rev
       Xinu

 
 
80How To Get The Nth Word Of A Line In UNIX?
Date Posted: 07/02/2012

Ans: Assuming the words in the line are separated by space, we can use the [cut] command. [cut] is a very powerful and useful command and it's real easy. All you have to do to get the n-th word from the line is issue the following command:
Cut –f<n> -d' '
'-d' switch tells [cut] about what is the delimiter (or separator) in the file, which is space ' ' in this case. If the separator was comma, we could have written -d',' then. So, suppose I want find the 4th word from the below string: “A quick brown fox jumped over the lazy cat”, we will do something like this:
$> echo “A quick brown fox jumped over the lazy cat” | cut –f4 –d' '
And it will print “fox”

 
Showing 71 - 80 of 324 Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next
Shadow Bottom
 
 
© 2005 -