Thursday, 30 August 2012

Unix Questions

Question 1:Without opening in vi mode , replace a particular string.

Answer: It can be done by using 'sed' command in UNIX
The wikipedia link is given below

sed on Wikipedia

Example:
 sed -e 's/oldstuff/newstuff/g' inputFileName > outputFileName

Question 2: How to hold a workflow by a UNIX command.
Answer:
 'wait' command can do the job

Though 'sleep' command can can make a job to wait for a particular time
e.g. ->    sleep 5
This will sleep the job for 5 seconds

e.g of wait command:
wait [pid] [jobid]

pid= process id
jobid=job id

Question 3: How to display the 10th line of a file and last 2 lines in one command?
Answer: Awaiting for the answer
 
 
 
 
 
 
 
 
 
 

No comments:

Post a Comment