顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2011年10月22日 星期六

2011年10月12日 星期三

Get the number of lines in file

grep -c "" <file>

NFS setting


Server : 10.1.1.1

Client : 10.1.1.2



先在 Server 安裝 nfs
# zypper in nfs-utils
或是 ( By Garlic )
# zypper in nfs-kernel-server



接著設定
# vi /etc/exports
/home/PXE/linux 10.0.0.0/8(ro,no_root_squash,async)

設定開機就啟動
chkconfig nfsserver 35

以上 Server 的設定完成



接著 Client 的部份

執行
# showmount -e 10.1.1.1
會顯示有那些可以 Mount

接著執行 Mount
# mount 10.1.1.1:/home/PXE/linux /tmp/linux

如果要設定開機就自動掛載 NFS 的檔案。可以在 /etc/fstab 中設定
# vi /etc/fstab
10.1.1.1:/home/PXE/linux /tmp/linux nfs defaults 0 0

以上完成

install LAPACK

将make.inc.example改名为make.inc,
编辑一下make.inc,将编译器指定为你的编译器ifort,

FORTRAN = ifort
OPTS = -funroll-all-loops -O3
DRVOPTS = $(OPTS)
NOOPT =
LOADER = ifort
LOADOPTS =

修改一下那个makefile,其实里面有个让你选的,

就可以编译了:
make lib
变异完了出现3个.a文件,改个名字,前面加lib。拷贝到我上面说的目录。
#lib : blaslib ,lapacklib , tmglib ...
lib : lapacklib ,tmglib ,..
改成
lib :blaslib ,lapacklib,tmglib ..
# lib :lapacklib ,tmglib ,..


复制blas_LINUX.a lapack_LINUX.a和tmglib_LINUX.a则三个文件到/usr/lib和/usr/local/lib两个文件夹中,并改名为:libblas.a liblapack.a和libtmglib.a

Link to lapack:
ifort -o fcode fcode.f -L/usr/local/lib -llapack -lblas

2011年10月10日 星期一

Split files according to index

 Suppose I have a csv file like this:
27, california , A3
27, vermont, B6
27, ontario, B7
34, kansas, C9
34, washington, A2

How do I split this file into two files according to field1.
file1:
27, california , A3
27, vermont, B6
27, ontario, B7
file2:
34, kansas, C9
34, washington, A2



awk -F"," ' { print > "file"$1 } ' filename

display only first few several lines from file Linux UNIX command

let say i only want to show the first six lines, then i would use this command

head -6 users.txt

awk command to merge columns from two separate files into single file

> cat file1
one two three
one two three
one two three
one two three

> cat file2
four five six
four five six
four five six
four five six

> pr -m -t -s file1 file2 | gawk '{print $4,$5,$6,$1}'
four five six one
four five six one
four five six one
four five six one