He enfrentado el problema de usar comandos de shell simples como AWK e imprimir dentro de mis scripts sh en mi Mac (el mismo script funciona perfectamente en Linux). Por ejemplo, debajo del script que busca las columnas dentro de los archivos de entrada dados no funcionó
#! /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
salida:
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
Aquí algunas pruebas del 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