Command Line Calculator for csh (C Shell)

November 3, 2009 - Leave a Response

Just add

alias calc ‘awk “BEGIN{ print \!:1 }”;’

to your .alias or whatever-your-default-shell-file-is file.

Restart the terminal.

Example usage:

  • calc 4*4

Though, it gets a bit cluttery if you want to use parenthesis.

  • calc “1000000\*\(1.45\+6.2\)\/100″

You need to put the whole expression in double quotes and use the escape character “\” for every symbol (*,/,),(,+,-) you use in the expression.

But in the end, it works! :)

Update 1:

Just add

   alias calc ‘echo "\!:*" | bc -l’

to your .alias or whatever-your-default-shell-file-is file.

Restart the terminal.

Example usage:

  • calc 4*4
  • calc 1000000*(6.2+1.45)/100
  • calc 4^4 ( calculation of powers also works using bc! )

References: 1 2

Removing hyperlinks from the whole Word document

October 30, 2009 - Leave a Response

Select the portion from where you want to remove all the hyperlinks, press Ctrl + Alt + F9. Done!

I use Word 2007 and it worked for me.

Playing with Fractions and Integers in Excel

April 1, 2009 - Leave a Response

Have you faced a situation in Excel where you want it to automatically show integers as integers and fractions as proper fractions (e.g. 8/3) and not mixed fractions (e.g. 2 2/3) or decimals (e.g. 2.6667)?

Well, I faced that situation today.  Excel does not have a direct solution to this.

Yes, you can go to ‘Format Cells’ -> ‘Number’ and choose the format you want.

I will take two numbers to show an example of my problem: 8 and 8/3.  I want them to be shown just as I typed them here.

Problem if I use default Fractional format (“# ???/???”): I see those numbers as 8 and 2 2/3.
Problem if I use a custom Fractional format (“???/???”)
: I see those numbers as 8/1 and 8/3.

Solution:
=IF(MOD(A1,A2)=0,TEXT(A1/A2,”#”),TEXT(A1/A2,”???/???”))
NOTE: A2 could be 1.
Here I have used A1 and A2 as example cells.  For my application, I needed the formula,
=IF(MOD(B$4,(2*$A5))=0,TEXT(B$4/(2*$A5),”#”),TEXT(B$4/(2*$A5),”???/???”))