Wednesday, April 28, 2010

Function in shell script

Declare the function before calling it.# Function to get password
functionGetpwd()
{
echo "Please provide $USR database password"
read PWORD
echo "Connecting to Database"
}

Call the function
 functionGetpwd

Monday, April 26, 2010

Convert from EBCDIC to ASCII

dd if=InputFile of=OutputFile conv=ascii

The above command will convert EBCDIC InputFile to ASCII OutputFile. If you omit of=OutputFile, the output fill go to stdout.
If you want to use stdin, remove if=InputFile. Use control+D to terminate input.

I kept forgetting the dd command, hence this post, which it seems is versatile. It can be used to convert from lowercase or uppercase or convert only n bytes or blocks at a time. Further, I can combine the conversion keywords. e.g.

dd if=testE.dat conv=ebcdic,lcase

Friday, April 9, 2010

Remove Hyperlinks from excel worksheets

Sub RemoveHyperlink()
'
' Remove Hyperlink from each and every cell of you worksheet
'
'
Dim TotalCols as Integer
Dim TotalRows as Integer

For k = 1 To TotalCols
For i = 1 To TotalRows
Cells(i, k).Select
Selection.Hyperlinks.Delete
Next
Next
End Sub

Thursday, April 8, 2010

Zip and Unzip Unix

unzip filename.zip
will unzip the file

unzip -l filename.zip
will list the content of the archive

unzip -d chosenDir filename.zip
will unzip the the file in your chosenDir

zip filename.zip addNewfile.txt
will addNewfile.txt to the existing archive filename.zip


#