Convert lower case to uppercase and vice versa shell script

The following shell script will convert lower case letters to upper and uppercase to lower case.


bash-3.00# echo ramu |  tr  "[:lower:]" "[:upper:]"
RAMU

bash-3.00# echo RAMU |  tr  "[:upper:]" "[:lower:]"
ramu

bash-3.00#  echo RamU |  tr  "[:upper:]" "[:lower:]"
ramu

Replace a particular word in a file shell script - sed

How to replace a particular word in a file.


Single command :
sed "s/rama/krish/g" "a.txt" > b && rm -f a.txt && mv b a.txt
Here the above command replaces the word "rama" by "krish" in the file a.txt

To see a complete shell script see this.

Simple RFT script to test Google home page

Here is Simple dynamic RFT script which will launch a browser and then opens google home page and enters some thing in the search text box and searches for the same ...
Here is the RFT code to make it work

public void testMain(Object[] args)
    {
        startBrowser("http://google.co.in");
        sleep(25);
        TestObject[] to = getRootTestObject().find(
                atDescendant(".class","Html.INPUT.text",".title","Google Search"));
        // print dialog test object properties to console
        /*for (int i = 0; i < to.length; i++) {
           System.out.println (to[i].getProperties());
        }*/
        GuiTestObject contactLink = new GuiTestObject(to[0]);
        contactLink.click();
        BrowserTestObject b = findBrowser();
        b.inputChars("How to use RFT find method");
        TestObject[] to1 = getRootTestObject().find(
                atDescendant(".class","Html.INPUT.submit",".value","Google Search"));
        GuiTestObject searchButton = new GuiTestObject(to1[0]);
        searchButton.click();
        sleep(20);
        b.close();
    }
    private BrowserTestObject findBrowser(){
        TestObject[] foundTOs = find(atDescendant(".class", "Html.HtmlBrowser"));
        BrowserTestObject browser = (BrowserTestObject) foundTOs[0];
        return browser;
    }
}

SQL query to finf employees details for second maximum salary

Select * from emp where sal= (select max(sal) from emp where sal<(select max(sal) form emp))

The above query returns all the details of the employee whose salary is second highest.

(select max(sal) from emp where sal<(select max(sal) form emp)) will return the second max salary of an employee.

More : [1]