Nan Xiao's Blog

A system software / performance engineer's home

Month: March 2016

Install openssl-0.9.8 for SAP HANA

SAP HANA has a special love for openssl-0.9.8, so to install SAP HANA, you must first get openssl-0.9.8 dynamic library ready:

(1) Download openssl-0.9.8 source code from here, and uncompress it.

(2) To build dynamic library, you should add shared option when configuring:

./config shared
make install_sw

(3) Because the default installation directory is /usr/local/ssl, to let SAP HANA find the openssl library, you should add/usr/local/ssl/lib into /etc/ file:

# cat /etc/
include /etc/*.conf
# /lib64, /lib, /usr/lib64 and /usr/lib gets added
# automatically by ldconfig after parsing this file.
# So, they do not need to be listed.

Then execute ldconfig command:

# ldconfig

It is OK for installing SAP HANA now.


How to count the line number of a file?

How to count the line number of a file? It seems an easy question for Unix guys: using wc command. Let’s see an example:

# cat test
# wc -l test
3 test

It displays right. But wait a minute, let’s check the wc -l option meaning:

# wc --help
-l, --lines            print the newline counts

wc -l just print the newline counts, so it increases newline count as the line number. Using hexdump to see the content of test:

# hexdump -C test
00000000  61 61 61 61 0a 62 62 62  62 0a 63 63 63 63 0a     |aaaa.bbbb.cccc.|

No problem, test contains 3 newlines. But now, the question is here, how about the last line doesn’t contain newline?

Let me do the following experiment:

# echo -n "a" > test
# hexdump -C test
00000000  61                                                |a|
# wc -l test
0 test

Now the test file only contains 1 character, and no newline. This time, wc -l thinks there is no line in test file.

Based on the previous discussion, maybe awk is a better tool when using to count line number of file. Just one statement:

# awk 'END {print NR}' test

It outputs right line number.

Powered by WordPress & Theme by Anders Norén