Pesquisar este blog

sexta-feira, 1 de novembro de 2013

Shell commands

TAR

tar -xf \a\b\ca.tar file

tar -tvf  xxx.tar (list the contents of a tar or gzip file)

tar -tvf RHO.tar | sed -n '/leap/p'

tar --extract --file={tarball.tar} {file} 
example: tar --extract --file=rho.tar rho.pdb

tar cvf ~/a.tar `find -name tddft.out`

tar cvf a.tar --exclude=*.chk *


awk {'print $3,$6,$7,$8'} QM.coor

tail -n X file list X final lines from file

ls -p | grep "/" list only directories

diff FILE1 FILE2 compare 2 different files

GREP

grep "f=" $i | awk '{print $3,$6}' > $i

grep -A3 "STATE=" 12.out (3 lines after find "STATE")

grep -B3 "STATE=" 12.out (3 lines before find "STATE")

grep -v case #(everything except case) cat 1XDN.pdb | grep -v " HOH "
| grep -v " ATP " | grep -v " MG " > rece

Find

find ./* -type f -exec grep -l tddft {} \; | more

find ./ -size +1G -name *dcd

find . -iname "*.out"

find bin opt -iname "*.out"


cat 12.out|head -100|tail -50

ls *out | wc -l

paste file1 file2 > file3 paste name telephone > nameNtelephone

killall -9 cpmd.x

du -sh

touch -t 201204261000 *

sort -k 7 -n file sort 7th column in numerical order

sort -k 7 -r file sort 7th column in reverse order

awk {'print $1,'$i''} print the column 1 and the variable $i. Note
that the variable is in 'quotes'

cat filedata | awk '{ sum+=$8} END {print sum}'         sum a column of numbers


cat close_contacts.dat | sed 's/ /\'$'\n''/g' > a.dat # convert lines
in a file in column

printf '1 2 3 4' | sed 's/ /\'$'\n''/g' # convert line in column

emacs rectangle:

chmod +w file.dat

1)put the cursor in the top left point and press Ctr SPC

2) move the cursor to the botton rigth point and press: Ctr-x r


C-x r k Kill rectangle

C-x r d Delete rectangle

C-x r y Yank rectangle

C-x r c Clear rectangle

Nenhum comentário:

Postar um comentário