Pesquisar este blog

sexta-feira, 1 de novembro de 2013

shell script

sed -n '/ 1 /p' FM_REF_FORCES > 1.dat


Get the lines starting with "i" and put in "i.dat" files

for ((  i = 1 ;  i <= 24;  i++  ))
do
echo "$i"
sed -n "/ $i /p" FM_REF_FORCES > $i.dat
done


SED

o Sed é orientado a linha, de cima para baixo, da esquerda para a direita.

A sintaxe genérica de um comando Sed é:

sed [opções] regras [arquivo]

Sendo que regras tem a forma genérica de:

[endereço1 [, endereço2]] comando [argumento]


Como dica geral SEMPRE coloque os comandos do Sed entre aspas simples

$ more exemplo
Folha de Sao Paulo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo

$sed -n 'p' exemplo 
Folha de Sao Paulo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo

O Globo

$ sed -n '1p' exemplo 
Folha de Sao Paulo

$ sed -n '2p' exemplo 
O estado de Sao Paulo

$ sed -n '3p' exemplo 
Noticias Populares



ENDEREÇO

Deleta a 2° linha ou a linha que contenha a palavra estado

$ sed '2d' exemplo 
Folha de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo

sed '/estado/d' exemplo 
Folha de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo


Imprimi a 2° linha ou a que contenha a palavra estado

$ sed -n '2p' exemplo 
O estado de Sao Paulo

$ sed -n '/estado/p' exemplo 
O estado de Sao Paulo



Deleta e imprimi linhas dentro do range 2 a 4

$ sed '2,4d' exemplo
Folha de Sao Paulo
O Globo

$ sed -n '2,4p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo

Deleta e imprimi entre a linha 2 e a palavra gazeta:

$sed '2,/Gazeta/d' exemplo
Folha de Sao Paulo
O Globo

$ sed -n '2,/Gazeta/p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo



Deleta e imprimi entre duas palavras:

$ sed '/estado/,/Gazeta/d' exemplo
Folha de Sao Paulo
O Globo

$ sed -n '/estado/,/Gazeta/p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo


No endereço, temos um caractere especial, o $ que referencia à última linha do texto. Assim sendo, para apagar da linha 2 até o final do texto:

$ sed '2,$d' exemplo
Folha de Sao Paulo

Imprimir a linha, a linha mais 1 linha, e mais 2 linhas.....

$ sed -n '/estado/p' exemplo
O estado de Sao Paulo

$ sed -n '/estado/,+p' exemplo
O estado de Sao Paulo

$ sed -n '/estado/,+1p' exemplo
O estado de Sao Paulo
Noticias Populares

$ sed -n '/estado/,+2p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo

$ sed -n '/estado/,+3p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo


Interrompa o sed até a primeira linha em branco

$ sed '/^$/q' exemplo


Colocando na frente do d ou p o simbolo !, invertemos a lógica do comando

$ sed -n '/estado/p' exemplo
O estado de Sao Paulo

$ sed -n '/estado/!p' exemplo
Folha de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo



Este comando apaga as linhas 5, 10 e as que têm estorvo do arquivotexto.txt.
$ sed '1d;3d;/estado/d' exemplo

Substitui a 1° ocorrencia (por linha) da palavra Gazeta por bobao no arquivo exemplo
sed -e 's/Gazeta/bobao/' exemplo



sed -e 's/Gazeta/bobao/g' exemplo

substitui no arquivo todo!

___________________________________________
Programa para obter os resultados do 3DNA

#Para executar o programa digite: 
#sed -n -f programa.sed 3dna_output.out > opening.dat


# Obter o conteúdo entre a TAG < > </ >
//{:a;/<\/opening>/!{N;ba;};p;}


# Para obter o conteúdo entre a TAG < > </ > retirando a TAG:
#//{/{<\/opening>}/tc;:a;/<\/opening>/!{N;ba;};:c;s/.*//;s/<\/opening>.*$//;p;}



ou ....



#!/bin/sh
sed -n '//{:a;/<\/alpha1>/!{N;ba;};p;}' ensemble_example.out > alpha1.dat


#inserir uma linha em rbanco no inicio do arquivo
 sed '1i\ ' arq > arq2




Texto editado de: http://aurelio.net/sed/sed-HOWTO/

VMD label under construction....

proc label_atoms { top all } {
  set sel [atomselect top all]
  set atomlist [$sel list]
  foreach {atom} $atomlist {
    set atomlabel [format "%d/%d" top $atom]
    label add Atoms $atomlabel
  }
}


set sel1 [atomselect top all]
set atomlist [$sel1 list]
foreach {atom} $atomlist {
    set atomlabel [format 0/2 top $atom]
    label add Atoms $atomlabel
        show type
  }




set sel [atomselect top all]
set a [$sel get type]

ptraj

# ptraj example

trajin eq_density.rst                       coordinates file to read
trajout reimaged.rst restart          output file in the same format as the input
center :1                                                    center the box to the geometric center of residue 1
image center                                                    force all the molecules into the primary unit cell

#Run ptraj according this syntax:
ptraj dna_solv.top < test.ptraj



trajin md2.mdcrd 1 19000 5 [start stop offset]
strip :WAT,Na+                      #take care with blank spaces
center :1-20 mass origin 
image origin center familiar 
trajout output.pdb pdb append 

If you use cpptraj you can omit the 'append' keyword from the
'trajout' command since MODEL/ENDMDL keywords are added automatically
for multiple frame PDB output files.




trajin eq_density.rst
trajout reimaged.rst restart
center :1-12
image center

trajin cie_solv_md3.mdcrd
trajin cie_solv_md4.mdcrd
center :1-25 mass origin 
image origin center familiar 
trajout output.cdf netcdf


9.1 ptraj coordinate input/output commands

trajin filename [ start stop offset] [remdtraj remdtrajtemp reptemp] 

reference filename

trajout filename [ format ] [ nobox ] [ nowrap ] [ append ] [ remdtraj ] [ lessplitjaverage ] [ little j big ] \
[ dumpqj parse ] [ title title ] [ application application ] [ program program ]

filename [ format ]: Specify the name of a file for output coordinates (filename) written
in a specific format (format). Currently supported formats are:


trajectory – Amber ascii trajectory, the default

restart – Amber restart

binpos – Scripps binary format

pdb – PDB, the traditional format (not the newer CIF files); if molecule information is present, TER cards will be written between molecules.

cdf | netcdf – Amber NetCDF binary trajectory

charmm – CHARMM DCD binary trajectory


Note that the allowable formats include both trajectory files (i.e., a series of frames) and
files that traditionally include only a single coordinate set. In this latter case, the filename
will be appended with .N where N is the frame number (unless the optional keyword
append is specified).

media e desvio

awk '{ total += $2; count++ } END { print total/count }' test_opening.dat





#!/usr/bin/awk -f
#
#     Programa para calcular media e desvio padrao em awk
#----------------------------------------------------------

{
   soma+=$1
   somaquad+=$1*$1
}

END {
       media=soma/NR
       desvpad=sqrt((somaquad - NR*media**2)/(NR - 1))
       printf    "Media (Desvio): %.2f  %.2f\n" , media, desvpad
    }




From:
http://blog.eldermarco.com/2011/06/media-e-desvio-padrao-em-awk/

VMD scripts


# mostrar o complexo (resid 1) e as aguas a 3 angstrons do cobre (index 3)
(water or resid 1) and same residue as (within 3 of index 3)
(water or nucleic) and within 3.5 of name Cu
water and same residue as (within 2.5 of resid 1)
water within 2.5 of resid 1
resid 2 3 and within 20 of index 13
name OW and (within 2 of backbone)
resname CIE DA DT DC DG and (within 4 of resname CIE)
resname 'Na+'
all and not resname "Cl-"

# coloque 'update selection' na guia trajectory
nucleic and (within 7 of resname CIE)
# neste caso vai selecionar so os átomos do nucleic que estao perto do serial 4
nucleic and (within 3 of resname CIE and serial 4)

#Selecionar apenas o restante das moleculas sem incluir o CIE
not resname CIE and within 5 of resname CIE

index 10 11 12
index 10 to 12

resname QUA pro
residue cys ala
resid 1 2 3

type H HO
element H C N O (?)

protein not hydrogen

vmd –parm7 acetone_solv.top –rst7 acetone_solv.rst
vmd –parm7 acetone_solv.top –crdbox “outputfile”.crd
mol addfile equil-press/equil-$i.crd type crdbox waitfor all



# diferença entre resid e residue

residue 0 to 342 # mostra os resíduos de um único domínio
resid 1 to 343 # mostra os resíduos dos vários domínios enumerdos de 1 até n. Normalmente as moléculas de água e os aminoácidos iniciam por 1, desta forma quando o selecionamos os dois aparecem na tela.


#Habilitar o log para verificar a ação equivalente da linha de comando
# no terminal digite:
log nome.log

log off

#Load script files
vmd -e load.tcl
vmd -e vmd.vmd

cat load.tcl
#LOAD FILES
set mol [mol new cie_solv.top type parm7 waitfor all]
for {set i 3} {$i <= 7} {incr i} {
    mol addfile cie_solv_md$i.mdcrd type netcdf waitfor all
}

#gravar arquivo pqr
vmd -dispdev text
set mol [mol new prot_solv.top type parm7 waitfor all]
mol addfile reimaged14.rst.1 type rst7
animate write pqr test.pqr
#animate write pqr {/home/marcos/Desktop/rst/aaaaaaa.pqr} beg 0 end 0 skip 1 0

#gravar trajetória e pdb de frames e seleção específica (não funciona porque as H2O se afastam)
vmd -dispdev text
set mol [mol new cie_solv.top type parm7 waitfor all]
mol addfile output.cdf type netcdf first 0 last 2000 step 1 waitfor all
set sel [atomselect top "all and same residue as (within 5 of resname CIE)"]
animate write dcd com_traj.dcd beg 1 end 2000 sel $sel
animate write pdb com_traj.pdb beg 1 end 1 sel $sel


# adicionar label pela linha de comando
label add Atoms 0/6323
label addspring 0 4296 4299 1


vmd > label
label add [Atoms|Bonds|Angles|Dihedrals] {atoms as /}
label addspring
label list              -- return label categories
label list   -- return id's of labels in given category
label [show|hide|delete] [index] -- 
Control specific label or all labels in category
label graph -- Return a list of values for the given label
for all animation frames
label textsize []
label textthickness []

# convenções no VMD
resid no VMD pode ser mais de um tipo de residuo, por ex:
resid 1 quer dizer os residuos CIE 1 e também a primeira molécula de água: SOLV 1
Assim pra salvar mais de um composto pode ser interessante utilizar: "resname CIE or resid 234 765", assim salvará apenas 3 resíduos


From:
http://www.ks.uiuc.edu/Research/vmd/vmd-1.7/ug/node192.html

VMD Command-Line Options

When started, the following command-line options may be given to VMD. Note that if a command-line option does not start with a dash (-), and is not part of another option, it is assumed to be a PDB filename. Thus, the Unix command
        vmd molecule.pdb
will start VMD and load a molecule from the file molecule.pdb. On the Windows platform, one must preface the VMD invocation with the Windows start command
        start vmd molecule.pdb
  • -m : Load all subsequent files into separate molecules. The -f and -m options may be specified multiple times on the command line in order to load multiple molecule containing one or more files.
  • -h | -? : Print a summary a command-line options to the console.
  • -e filename : After initialization, execute the text commands in filename, and then resume normal operation.
  • -psf filename : Load the specified molecule (in PSF format) at startup. The PSF file only contains the molecular structure; a PDB or DCD file must also be specified when this option is used.
  • -pdb filename : Load the specified molecule (in PDB format) at startup.
  • -dcd filename : Load the specified trajectory file (in binary DCD format) at startup. The DCD file only contains atomic coordinates; a PDB or PSF file must also be specified when this option is used.
  • - filename : Load the specified file using the given filetype.
  • -f : Load all subsequent files into the same molecule. This is the default. A new molecule is created for each invocation of -f; thus, vmd -f 1.pdb 2.pdb -f 3.pdbloads 1.pdb and 2.pdb into the same molecule and 3.pdb into a different molecule.

  • -dispdev < win | text | cave | caveforms | none > : Specify the type of graphical display to use. The possible display devices include:
    • win: a standard graphics display window.
    • text: do not provide any graphics display window.
    • cave: use the CAVE virtual environment for display, forms are disabled.
    • caveforms: use the CAVE virtual environment for display and with forms enabled. This is useful with -display machine:0 for remote display of the forms when the CAVE uses the local screen.
    • none: same as text.
    It is possible to use VMD as a filter to convert coordinate files into rendered images, by using the -dispdev text and -e options.
  • -dist z : Specify the distance to the VMD image plane.
  • -height y : Specify the height of the VMD image plane.
  • -pos x y : Specify the position for the graphics display window. The position (x,y) is the number of pixels from the lower-left corner of the display to the lower-left corner of the graphics window.
  • -size x y : Specify the size for the graphics display window, in pixels.
  • -nt : Do not display the VMD title at startup.
  • -startup filename : Use filename as the VMD startup command script, instead of the default .vmdrc or vmd.rc file.
  • -debug [level : Turn on output of debugging messages, and optionally set the current debug level (1=few messages ... 5=many verbose messages). Note this is only useful if VMD has been compiled with debugging option included.

DynDom - Protein Domain Motion - PBP

Programa online que identifica as regiões na proteína que sofrem modificações conformacionais tendo cmo ase duas estruturas. O programa pode ser baixado para estudar uma trajetória de MD.

Resíduos envolvidos no bending (hinge group) para as duas estruturas cristalizadas.
http://fizz.cmp.uea.ac.uk/dyndom/

resid 75 to 77 227 to 241 254 to 255




Gnuplot


# PRINT SYMBOL AND SUBSCRIPT/SUPERSCRIPT
set terminal postscript eps enhanced mono lw 1 "Helvetica" 28 size 6.0,4.0
set ylabel "{/Symbol q} [deg cm^2 dmol^{-1}]"      

# Print anstrom:
set encoding iso_8859_1        
set ylabel "RMSD [\305]"

# PRINT in png file
set term png
set output "energies.png"

# Fixar o tamanho do gráfico
set bmargin 1.5
set lmargin 1
set rmargin 1
set tmargin 1

# REMOVE X/Y TICS
set xtics ""
set ytics ""

set xtics 0.5
set ytics 0.3

# REMOVE LABELS
set format x ""
set format y ""
#REINTRODUCE LABELS AND SCALE
set format x

# Exponential
# exponential format: XXe+0X
set format x "%6.0e"

# XTICS
set xtics ("April" 1, "May" 2, "June" 3, "July" 4)

set xtics 10000

# EIXOS CARTESIANOS
set {x|x2|y|y2|z}zeroaxis { {linestyle | ls }
                                | { linetype | lt }
                                  { linewidth | lw }}
     unset {x|x2|y|y2|z}zeroaxis
     show {x|y|z}zeroaxis

set xzeroaxis ls 5 lt 3 lw 1.5

set yzeroaxis ls 5 lt 3 lw 1.5

# shell script
#!/bin/sh
gnuplot << EOF
set format x "%.1e"
set term png  lw 1 font 'Verdana,5'
set output "Mult.png"
set yrange [1.5:4]
set xrange [0:3513]
set multiplot layout 2,2
p "Cu-DC21_O1P.dat" u 1:2 w l lc -1 # cor preta lc -1
p "Cu-DC21_O2P.dat" u 1:2 w l
p "Cu-DC20_O1P.dat" u 1:2 w l
p "Cu-DC20_O2P.dat" u 1:2 w l

EOF
display Mult.png

# plotar mais de uma coluna num único arquivo
plot 'test.dat' title 'data', \
     ' ' u ($1-dx):(d($2)) title '1-variable derivative', \
     ' ' u ($1-dx):(d2($1,$2)) title '2-variable derivative', \
     ' ' u ($1-dx):(d2($1,$2)) smooth csplines title '2-variable derivative (smoothed)'



p "1.out" u 1:2 t "" w lines lt 1 lw 5

set multiplot layout 5,5
set tics scale 0 # scale of tics, 0 is without tics
set bmargin 1.5
set lmargin 1
set rmargin 1
set tmargin 1
# set title "TDDFT calculation"
set xrange [2:4]
set yrange [0:0.35]
# set xtics offset 0,graph 0.05 #position of the x label
set ytics offset 0,graph 0.1
#set xtics 0.5
#set ytics 0.3
set xlabel ""
set ylabel ""

# remove the legend, x and y labels
#set nokey
set format x ""
set format y ""

#change the tics marks and tics labels
set format x
set format y
set ytics offset 0,graph 0.1
set xtics 0.5
set ytics 0.3



XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX PLOT ENERGIES FILE XXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXX

set term png
set output "energies.png"

set multiplot layout 2,3 title ""
set bmargin 3
#set xtics 20000
#set format x "%6.0e"
plot "ENERGIES" u 1:3 t "TEMPERATURE" w l
plot "ENERGIES" u 1:2 t "EKINC" w l
plot "ENERGIES" u 1:4 t "EKS" w l
plot "ENERGIES" u 1:5 t "ECLASSIC" w l
plot "ENERGIES" u 1:6 t "EHAM:conserved ?" w l


set multiplot layout 1,2 title ""
set bmargin 3
set yrange [-0.5:4.5]
plot "ENERGIES" u 1:($5-$4) t "Enuclei" w l, "ENERGIES" u 1:(5*$2) t "5xEkinc" w l
set yrange [-82:-75.0]
plot "ENERGIES" u 1:4 t "EKS" w l, "ENERGIES" u 1:5 t "ECLASSIC" w l, "ENERGIES" u 1:6 t "EHAM:conserved ?" w l




set multiplot layout 2,3 title ""
set bmargin 3
plot "ENERGIES" u 1:2 t "EKINC" w l
plot "ENERGIES" u 1:3 t "TEMPERATURE" w l
plot "ENERGIES" u 1:4 t "EKS" w l, "ENERGIES" u 1:5 t "ECLASSIC" w l, "ENERGIES" u 1:6 t "EHAM:conserved ?" w l




XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX PLOT ELECTRONIC SPECTRA XXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


grep "f=" tddft_original.out | awk '{print $3,$6}' > 1.txt
gnuplot
set title "TDDFT calculation"
set xlabel ""
set ylabel "Transition (eV)"
plot "1.txt" u 1:2 title "Absorsion" w impulses




XXXXXXXXX OTHERS XXXXXXXXXXXXXXXX
exponential format: XXe+0X
set format x "%6.0e"

set term png
set output "energies.png"


set xtics ("April" 1, "May" 2, "June" 3, "July" 4)

set xtics 10000

plot "test.dat" using 1:2:3 with yerrorbars
plot "test.dat" using 1:2:3 with xerrorbars


Create a title:                  > set title "Force-Deflection Data"
Put a label on the x-axis:       > set xlabel "Deflection (meters)"
Put a label on the y-axis:       > set ylabel "Force (kN)"
Change the x-axis range:         > set xrange [0.001:0.005]
Change the y-axis range:         > set yrange [20:500]
Have Gnuplot determine ranges:   > set autoscale
Put a label on the plot:         > set label "yield point" at 0.003, 260
Change the tic-marks:            >
set xtics 3000
set xtic ("0" 0,"3" 3000,"6" 6000,"9" 9000,"12" 12000,"15" 15000)
Move the key:                    > set key 0.01,100
Delete the Label line:           > unset key


set terminal postscript eps color lw 3 "Helvetica" 20
set output "spectra.eps"

#SOMAR COLUNA
 awk '{ soma = soma + $7} END {print soma} ' < cu.mol2



gnuplot
set multiplot
set xlabel ""
set ylabel ""
set size 1,0.2
set format x ""
set origin 0.0,0.8; plot "ENERGIES" u 1:2 t "EKINC" w l
set origin 0.0,0.6; plot "ENERGIES" u 1:3 t "TEMPERATURE" w l
set origin 0.0,0.4; plot "ENERGIES" u 1:4 t "EKS" w l
set origin 0.0,0.2; plot "ENERGIES" u 1:5 t "ECLASSIC" w l
set title "/local/GRS/Users/claudia/faceAB/5_TDDFT/CINCO/VEINTE"
set format x " %10.0f"
set xlabel "n steps"
set origin 0.0,0.0; plot "ENERGIES" u 1:6 t "EHAM:conserved ?" w l



#####
DOS

gnuplot
set terminal postscript eps color lw 2 "Helvetica" 20
set xrange [-13.75:-11.75]
#set multiplot layout 2,2
set output "apyhist.eps"
p  "./apyhist.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apyhist.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apyhist.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apyhist.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apyhist.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apyhist.txt" u 1:3 w l lw 4 lt 2 t ""
set output "apzhist.eps"
p  "./apzhist.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apzhist.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apzhist.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apzhist.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apzhist.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apzhist.txt" u 1:3 w l lw 4 lt 2 t ""
set output "apyepyt.eps"
p  "./apyepy.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apyepy.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apyepy.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apyepy.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apyepy.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apyepy.txt" u 1:3 w l lw 4 lt 2 t ""
set output "apzepy.eps"
p  "./apzepy.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apzepy.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apzepy.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apzepy.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apzepy.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apzepy.txt" u 1:3 w l lw 4 lt 2 t ""
exit

####
Fit

gnuplot
f(x) = mean_y
fit f(x) 'thr10_1.agr' u 1:2 via mean_y

set multiplot layout 2,2 columnsfirst

################
Average

echo "scale=2; `cat X2_X3a.dat | gawk '{sum+=$1}END{print sum}'` / `cat X2_X3a.dat | wc -l`" | bc



###############################

# Two axes
gnuplot
set xrange [200:800]
set yrange [0:0.45]
set y2range [0:45000]
set nokey
#set ytics 0.5 nomirror tc lt 1
#set ylabel '2*x' tc lt 1

#set y2tics 20000 nomirror tc lt 10000
#set y2label 'Absortion' tc lt 10000

plot 'UVData.txt' u 3:4 w i linetype 2, 'UVSpectrum.txt' u 2:3 w l linetype 1 axes x1y2 



# Plot using 2 axes
gnuplot << EOF

set term png lw 1 font 'Verdana,5'
set output "Mult.png"
set xrange [200:800]
#set yrange [0:0.45]
#set y2range [0:45000]
#set nokey
#set ytics 0.5 nomirror tc lt 1
#set ylabel '2*x' tc lt 1

#set y2tics 20000 nomirror tc lt 10000
#set y2label 'Absortion' tc lt 10000

set multiplot layout 3,1

plot 'gausssum2.2/UVData.txt' u 3:4 t "RHO2" w i linetype 2 , 'gausssum2.2/UVSpectrum.txt' u 2:3 t "" w l linetype 1 axes x1y2 
plot 'R1/gausssum2.2/UVData.txt' u 3:4  t "R1" w i linetype 2, 'R1/gausssum2.2/UVSpectrum.txt' u 2:3 t "" w l linetype 1 axes x1y2 
plot 'R2/gausssum2.2/UVData.txt' u 3:4   t "R2" w i linetype 2, 'R2/gausssum2.2/UVSpectrum.txt' u 2:3 t ""  w l linetype 1 axes x1y2 

EOF
display Mult.png &

Sites interessantes:
http://www.gnuplotting.org/

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