Skip to content

Commit

Permalink
Utility software to prepare files for sfdd #17
Browse files Browse the repository at this point in the history
This script prepares the txt files generated by sfipick
in a format readable by sfdd that convets them to RSF
  • Loading branch information
Dirack committed Mar 6, 2021
1 parent fa61633 commit 56408e9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions TDD/stereoniptomo/ascFormat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# ascFormat.sh (Shell Script)
#
# Purpose: Convert txt files generate by sfipick (iterative picking)
# to asc format accepted by sfdd to be converted to RSF.
#
# Site: https://dirack.github.io
#
# Version 1.0
#
# Programer: Rodolfo A C Neves (Dirack) 06/03/2021
#
# Email: rodolfo_profissional@hotmail.com
#
# License: GPL-3.0 <https://www.gnu.org/licenses/gpl-3.0.txt>.

[ -z "$1" -o "$1" == "-h" -o "$1" == "--help" ] && {
echo "Usage: <pick.txt $0 outfilename column > outfilename.asc"
echo "'pick.txt' is a file generated by sfipick"
echo "'outfilename' is the name of the output file"
echo "'column' is the number of the column selected from 'pick.txt'"
exit 0
}

INPUT=$(cat "-" | tr '\t' ' ' | cut -d' ' -f"$2")
NUMBER_OF_POINTS=$(echo "$INPUT" | wc -l)
FORMATED_INPUT=$(echo "$INPUT" | tr '\n' ' ')
FILE="$1"

echo "${FORMATED_INPUT}n1=$NUMBER_OF_POINTS d1=1 o1=0 data_format=ascii_float in=$1"

0 comments on commit 56408e9

Please sign in to comment.