Gostaria de rodar um Shell script salvando os arquivos csv. [RESOLVIDO]

1. Gostaria de rodar um Shell script salvando os arquivos csv. [RESOLVIDO]

Matheus  Bernardes Costa do Nascimento
matbnas

(usa Ubuntu)

Enviado em 18/08/2015 - 14:37h

Este script tem o objetivo de coletar uma gama de informaçoes das proteinas coletadas. Porem, gostaria de salvar os arquivos em csv.
 

for i in `ls` ;do#!/bin/bash
#currdir=$PWD
#cd $currdir

step1(){
rm -f list list1
find /Users/matheus/Desktop/Pdbpdg/ -name *.txt > list
cat list | sed -e 's/ /\\ /g' >list1
for i in `seq 2 12`;do rm -f list$i;done
rm -f list111 list1111 list66 list666
rm -f tabelatestefpocket-Pocket tabelatestefpocket-Druggability tabelatestefpocket-Number tabelatestefpocket-SASA-TOTAL tabelatestefpocket-SASA-POLAR tabelatestefpocket-SASA-APOLAR tabelatestefpocket-Volume Supertable.txt

while read -r linha ; do echo -e cat "$linha" >> list2 ;done < list1

for i in `seq 1 3502`;do echo "| head -n20 | grep Pocket >> tabelatestefpocket-Pocket" >> list3 ;done
for i in `seq 1 3502`;do echo "| head -n20 | grep Druggability >> tabelatestefpocket-Druggability" >> list4 ;done
for i in `seq 1 3502`;do echo "| head -n20 | grep Number >> tabelatestefpocket-Number" >> list5 ;done
for i in `seq 1 3502`;do echo "| head -n5 | grep SASA >> tabelatestefpocket-SASA-TOTAL" >> list6 ;done
for i in `seq 1 3502`;do echo "| head -n6 | tail -1 | grep SASA >> tabelatestefpocket-SASA-POLAR" >> list66 ;done
for i in `seq 1 3502`;do echo "| head -n7 | tail -1 | grep SASA >> tabelatestefpocket-SASA-APOLAR" >> list666 ;done
for i in `seq 1 3502`;do echo "| head -n8 | grep Volume >> tabelatestefpocket-Volume" >> list7 ;done
paste list2 list3 > list8
paste list2 list4 > list9
paste list2 list5 > list10
paste list2 list6 > list11
paste list2 list66 > list111
paste list2 list666 > list1111
paste list2 list7 > list12
chmod 700 list8
chmod 700 list9
chmod 700 list10
chmod 700 list11
chmod 700 list111
chmod 700 list1111
chmod 700 list12
./list8
./list9
./list10
./list11
./list111
./list1111
./list12

cat list2 |grep -o -P '.{0,11}info.{0,4}' > datalist


paste datalist tabelatestefpocket-Pocket tabelatestefpocket-Druggability tabelatestefpocket-Number tabelatestefpocket-SASA-TOTAL tabelatestefpocket-SASA-POLAR tabelatestefpocket-SASA-APOLAR tabelatestefpocket-Volume > Supertable.txt

}




step2(){

cd $i
head -n20 *.txt | grep Pocket > tabelatestefpocket-$i
head -n20 *.txt | grep Druggability >> tabelatestefpocket-$i
head -n20 *.txt | grep Number >> tabelatestefpocket-$i
head -n20 *.txt | grep SASA >> tabelatestefpocket-$i
head -n20 *.txt | grep Volume >> tabelatestefpocket-$i
done

exit
}

## run
step1
#step2
#step0



  


2. MELHOR RESPOSTA

Wellingthon Dias Queiroz - @tonyhts
tonyhts

(usa Arch Linux)

Enviado em 18/08/2015 - 18:30h

Olá,

Esse script ta confuso ao quadrado.rs
Várias partes não funcionam e outras estão comentadas, mas acho que o resultado que quer ele está te entregando no arquivo Supertable.txt, certo?

TXT são textos separador por tab
CSV são textos separados por virgula

Sugiro usar uma ferramente de conversão, pois mexer nesse script, vai ser osso !

A ferramenta: https://convertio.co/pt/txt-csv/

OBS1::: Acredito que ocorreu algum erro ao colar o script, mas em todo caso a linha 1 está errada. dever começar assim :
#!/bin/bash 


OBS2:: Esse "for in in `ls`;do" no começo, não faz sentido.( como outras partes tbm, mas essas impedem o script de funcionar)


Abs

---
Eu Acredito, que ás vezes são as pessoas que ninguém espera nada que fazem as coisas que ninguém consegue imaginar.

--- Mestre dos Mestres - Alan Turing ---

3. Re: Gostaria de rodar um Shell script salvando os arquivos csv. [RESOLVIDO]

Matheus  Bernardes Costa do Nascimento
matbnas

(usa Ubuntu)

Enviado em 18/08/2015 - 19:08h


O programa está funcionando. Vou mostrar o resultado. Mas agora quero outra função.
clean-1rcw_info.txt Pocket 1 : Druggability Score : 0.372 Number of Alpha Spheres : 178 Total SASA : 955.272 Polar SASA : 467.390 Apolar SASA : 487.882 Volume : 1908.128
clean-1syy_info.txt Pocket 1 : Druggability Score : 0.020 Number of Alpha Spheres : 67 Total SASA : 292.273 Polar SASA : 169.095 Apolar SASA : 123.178 Volume : 533.517
clean-2ani_info.txt Pocket 1 : Druggability Score : 0.050 Number of Alpha Spheres : 63 Total SASA : 310.276 Polar SASA : 158.115 Apolar SASA : 152.161 Volume : 692.921
clean-2iu8_info.txt Pocket 1 : Druggability Score : 0.520 Number of Alpha Spheres : 213 Total SASA : 844.511 Polar SASA : 289.497 Apolar SASA : 555.014 Volume : 1622.706
clean-2iu9_info.txt Pocket 1 : Druggability Score : 0.654 Number of Alpha Spheres : 447 Total SASA : 1714.230 Polar SASA : 634.333 Apolar SASA : 1079.896 Volume : 2621.943
clean-2iua_info.txt Pocket 1 : Druggability Score : 0.708 Number of Alpha Spheres : 543 Total SASA : 1969.055 Polar SASA : 688.968 Apolar SASA : 1280.086 Volume : 3823.131
clean-2m1b_info.txt Pocket 1 : Druggability Score : 0.141 Number of Alpha Spheres : 130 Total SASA : 471.050 Polar SASA : 211.409 Apolar SASA : 259.640 Volume : 1219.123
clean-3asa_info.txt Pocket 1 : Druggability Score : 0.776 Number of Alpha Spheres : 278 Total SASA : 1148.722 Polar SASA : 462.789 Apolar SASA : 685.933 Volume : 2468.349
clean-3asb_info.txt Pocket 1 : Druggability Score : 0.383 Number of Alpha Spheres : 129 Total SASA : 356.439 Polar SASA : 136.651 Apolar SASA : 219.788 Volume : 834.904
clean-3del_info.txt Pocket 1 : Druggability Score : 0.171 Number of Alpha Spheres : 234 Total SASA : 1080.701 Polar SASA : 590.403 Apolar SASA : 490.297 Volume : 1777.053
clean-3dja_info.txt Pocket 1 : Druggability Score : 0.090 Number of Alpha Spheres : 305 Total SASA : 968.274 Polar SASA : 573.380 Apolar SASA : 394.895 Volume : 1658.120
clean-3dor_info.txt Pocket 1 : Druggability Score : 0.093 Number of Alpha Spheres : 461 Total SASA : 1539.166 Polar SASA : 872.099 Apolar SASA : 667.066 Volume : 3367.405
clean-3dpm_info.txt Pocket 1 : Druggability Score : 0.088 Number of Alpha Spheres : 236 Total SASA : 774.257 Polar SASA : 369.701 Apolar SASA : 404.556 Volume : 1503.783
clean-3dpn_info.txt Pocket 1 : Druggability Score : 0.667 Number of Alpha Spheres : 232 Total SASA : 781.190 Polar SASA : 381.465 Apolar SASA : 399.725 Volume : 1360.492
clean-3gqs_info.txt Pocket 1 : Druggability Score : 0.212 Number of Alpha Spheres : 60 Total SASA : 224.078 Polar SASA : 73.125 Apolar SASA : 150.954 Volume : 353.268
clean-3k29_info.txt Pocket 1 : Druggability Score : 0.259 Number of Alpha Spheres : 51 Total SASA : 245.822 Polar SASA : 90.038 Apolar SASA : 155.784 Volume : 624.253
clean-3n08_info.txt Pocket 1 : Druggability Score : 0.112 Number of Alpha Spheres : 279 Total SASA : 1121.928 Polar SASA : 555.550 Apolar SASA : 566.378 Volume : 2436.250
clean-3q7r_info.txt Pocket 1 : Druggability Score : 0.407 Number of Alpha Spheres : 78 Total SASA : 305.473 Polar SASA : 204.033 Apolar SASA : 101.441 Volume : 700.963
clean-3q7s_info.txt Pocket 1 : Druggability Score : 0.824 Number of Alpha Spheres : 165 Total SASA : 558.270 Polar SASA : 287.761 Apolar SASA : 270.509 Volume : 964.123
clean-3q7t_info.txt Pocket 1 : Druggability Score : 0.873 Number of Alpha Spheres : 84 Total SASA : 322.263 Polar SASA : 116.966 Apolar SASA : 205.297 Volume : 545.430
clean-3qh6_info.txt Pocket 1 : Druggability Score : 0.217 Number of Alpha Spheres : 81 Total SASA : 203.571 Polar SASA : 77.344


4. Re: Gostaria de rodar um Shell script salvando os arquivos csv. [RESOLVIDO]

Wellingthon Dias Queiroz - @tonyhts
tonyhts

(usa Arch Linux)

Enviado em 18/08/2015 - 19:58h

Que bom !

Qual seria a função?

OBS:: quando for postar codigos ou coentúdo de arquivos, coloque entre tags <code>.


abs
---
Eu Acredito, que ás vezes são as pessoas que ninguém espera nada que fazem as coisas que ninguém consegue imaginar.

--- Mestre dos Mestres - Alan Turing ---






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts