How to use vlookup for microsoft Excel?  

Monday, July 2, 2012

Wondering how to use vlookup to search for a value?

Scenario 1:
Search a target cell to find out the existance from another column.


In the example above, we use the formula

=VLOOKUP(D3,B:B,1,FALSE)

we are searching cell D3 ('C') against column B (B:B), if exist, return value from B#, FALSE is to find exact match.


Scenario 2:
Search a target cell E8 ('D') against column B8:C10, if exist, return the value from column C.

=abs(h8-f8) to get the differences. ABS value of 0 means E9 value of 5 equivalent to B9 value of 5.


AddThis Social Bookmark Button
Email this post


How to customize PS1 prompt in BASH?  

Monday, October 18, 2010

Edit your .bashrc

export PS1="[\u@\w]\n>"

output:
[ubuntu@~/temp]
>



Relevant info: http://www.understudy.net/custom.html#Korn

AddThis Social Bookmark Button
Email this post


How to customize PS1 prompt in KSH?  

eg:

>[/current/dir] >
>
>I'd like it to be:
>[/current/dir]

edit your .profile

export PS1=[`hostname`:'$PWD]^V^J
>'
where ^V is control-V and ^J is control-J to accomplish this.

AddThis Social Bookmark Button
Email this post


How to replace ^M in unix to nothing?  

Monday, May 3, 2010

If you saw a lot of ^M character in your code, reason being is ^M is the character in DOS if you create the file in Windows.

If you transfer the DOS file into unix, you will see lots of ^M in your file and it is very irritating indeed.

You can do a simple magic in vi by

:%s/[crtl-v ctrl-m//g

meaning,
%s - substitute
[ctrl-v ctrl-m] - create the ^M character
// - empty
g - replace globally

AddThis Social Bookmark Button
Email this post


How to view file size/details from ls command in unix?  

Wednesday, July 8, 2009

I always find it difficult to digest the filesize from the ls -al command. For instance, after ls -al, the output give me filesize in bytes.

Gosh, then I have to start calculating it by taking last 4 digits, slowly count upwards like 1K, 10K, 100K, 1MB, 10MB, 100MB and so on so forth.

For instance:

this output:
-rw-r--r-- 1 walrus dba 137207094 Jul 8 23:12 config.2008032519.s

137207094 is how much?

going with my method of counting upwards, it gives me 137MB roughly.

Is it correct? WRONG. Hell wrong

The above is bits only. Bear in mind, 1 KB = 1024 bits, 1 MB = 1024 KB and so on so forth

[ Source ]
1 bit = a 1 or 0 (b)
4 bits = 1 nybble (?)
8 bits = 1 byte (B)
1024 bytes = 1 Kilobyte (KB)
1024 Kilobytes = 1 Megabyte (MB)
1024 Megabytes = 1 Gigabyte (GB)
1024 Gigabytes = 1 Terabyte (TB)

The correct calculation is 137207094 / 1024 (bits) / 1024 (KB) = 130.8 MB

Starting in Solaris 10, we have a new option in ls command.

: /u01/apps/WatchMark/FlexPM/classic/vendor/Lucent/ECP/ftpIN/in>uname -a
SunOS lxserver 5.10 Generic_118833-36 sun4u sparc SUNW,Sun-Fire-V445

ANCIENT WAY:
ls -al
total 270388
drwxr-xr-x 2 walrus dba 1024 Jul 8 23:14 .
drwxr-xr-x 11 walrus dba 512 Jun 17 01:49 ..
-rw-r--r-- 1 walrus dba 137207094 Jul 8 23:12 config.2008032519.s
-rw-r--r-- 1 walrus dba 451989 Jul 8 23:12 config.2008032519.split0.bz

cons: hard to read filesize and output distorted

NEW WAY:
ls -alh
total 269060
drwxr-xr-x 2 flexpm dba 1.0K Jul 8 23:12 .
drwxr-xr-x 11 flexpm dba 512 Jun 17 01:49 ..
-rw-r--r-- 1 flexpm dba 131M Jul 8 23:12 config.2008032519.s
-rw-r--r-- 1 flexpm dba 441K Jul 8 23:12 config.2008032519.split0.sm.gz

pros:
- more readable format in terms of file size
- contents are properly aligned.

cons:
- need to type extra 'h' at the end of ls command

AddThis Social Bookmark Button
Email this post


How to use regular expression (regex) in grep or vi?  

How to use regular expression (regex) in grep or vi?

If you need to search for a pattern of "string" or "character" in a file / many files, you will need to use regular expression (regex) either in vi editor or in grep command. But how? See below:

using vi:
- press '/' for searching
- for instance, i wanted to search for CL000, CL001, CL002, ie: the pattern is CLXXX follow by digit.
- syntax:
/^CL[0-9]*

^ - start of pattern
* - zero or more digit

using unix grep command:
- grep CL[0-9]

AddThis Social Bookmark Button
Email this post


How to change oracle user password?  

Tuesday, June 9, 2009

Question: How to change oracle user password?

Answer:

The syntax is:

alter user [user_name] identified by [new_password];

user_name is the user whose password you wish to change.

new_password is the new password to assign.

For eg:
I wanted to update system user password to helloworld

SQL> alter user system identified by helloworld;

User altered.

AddThis Social Bookmark Button
Email this post


Design by Amanda @ Blogger Buster