Archive for the ‘Unix’ Category

Vi: shortcut to replace word

Go to the relevant word. To replace it type cw . Then enter the word. To replace the line from the cursor onwards type c$ and type the replacement. To do the same change on multiple lines: Go to the position on the line where the change needs to be done. Then type . This [...]

Continue reading »

Calling stored Procedures from shell script

To call an oracle stored procedure from shell script you have to use sqlplus sqlplus -SILENT “user/pwd@sid” <<! exec “myProc”; using the SILENT option on sqlloader does not output anything related to sqlloader. You only get an output saying the procedure has successfully completed (or any error messages pertaining to the code)

Continue reading »

Split a line in Shell Script

One of the ways to splitting a line in shell script is to use the IFS variable. This defines on what character to split the input. By default its space Usage: shell script TEST=”folder/filename”; # You want the filename part IFS=/; val=”"; for i in $TEST do val=$i; # This stores the last value done [...]

Continue reading »

Formatting date in Unix

One of the requirements of my task was to format the return value of `date` as YYYY-MM-DD format. This is really simple. In my shell script I wrote echo `date +”%F”` And the output came as 2008-09-29. Doing a man or help on date will give you a list of all available options.

Continue reading »

xmllint: Good tool for xml check

In LINUX, xmllint is a good tool for checking the syntax of an xml file. Usage: xmllint filename This shows if there are any errors in the xml like missing tags, tags not matching etc. To format the xml in the branched way, use xmllint format xmllint –format filename This gives the formatted xml file.

Continue reading »

Getting Memory and CPU Info on LINUX

To get the memory and CPU information on LINUX machine use the following commands on your command prompt: cat /proc/meminfo cat /proc/cpuinfo You need not login as ROOT user for this

Continue reading »

Follow

Get every new post delivered to your Inbox.