mercredi 4 février 2015

Problems with using simple commands in MAC OS 10.9.4 terminal


I've faced with the problem of using simple shell commands like AWK and print within my sh scripts on my MAC ( the same script works perfect on the Linux). For instance below script which seek for the columns within given input files didn't works



#! /usr/bin/env bash
input=/Users/Own/Documents/Science/mmgbsa_results/All_decomp2/logs
output=/Users/Own/Documents/Science/mmgbsa_results/All_decomp2/out

for file in $input/*; do
title=$(basename "$file")
#print $title
awk -F’[|]’ '{print $1,$NF}' $file > ${output}/$title
done


output:



awk: no program given

analysis.sh: line 11: ]’: command not found
awk: no program given

analysis.sh: line 11: ]’: command not found
awk: no program given

analysis.sh: line 11: ]’: command not found
awk: no program given

analysis.sh: line 11: ]’: command not found
awk: no program given

analysis.sh: line 11: ]’: command not found
awk: no program given


Here some tests of the shell:



Glebs-MacBook-Pro:All_decomp2 Own$ echo $PATH
/Users/Own/anaconda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Glebs-MacBook-Pro:All_decomp2 Own$ awk
usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
Glebs-MacBook-Pro:All_decomp2 Own$ peint
-bash: peint: command not found




Aucun commentaire:

Enregistrer un commentaire