Archive for January, 2009

SSH without password

January 20, 2009

The following procedure will allow you to access and execute commands on remote servers without password

# from client's home do ...
client$ mkdir ~/.ssh
client$ chmod 700 ~/.ssh
client$ ssh-keygen -q -f ~/.ssh/id_rsa -t rsa
# do NOT enter passphrase

# upload public key from client to user's home at server ...
client$ scp ~/.ssh/id_rsa.pub user@server:

# setup the public key on server
server$ mkdir ~/.ssh
server$ chmod 700 ~/.ssh
server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/id_rsa.pub

client$ ssh user@server 'commands' 

fasta2tbl

January 19, 2009

A way to transform FASTA to tab delimited

#!/bin/bash
awk '
{
if (substr($1,1,1) == ">"){
  if (NR>1){
    printf "\n%s ", substr($1,2,length($1)-1)
  }
  else{
    printf "%s ", substr($1,2,length($1)-1)
  }
  }
else{
  printf "%s", $0
  }
}
END{printf "\n"}' "$@"

tbl2fasta

January 19, 2009

A way to transform tab delimited to FASTA

#!/bin/bash
awk ‘{
seq = $2
l = length(seq)
i = 1
printf ">%s\n", $1
while (i <= l){
  printf "%s\n", substr(seq,i,80)
  i=i+80
}
}’ "$@"

Hello world!

January 18, 2009

This is how this BLOG should start …


'BEGIN{print "Hello World"}'


Obviously, this is about AWK. Your are welcome to drop you scripts.