Within a loop in my bash script, I am 'doing work', then writing the result of each iteration to its own file. I'd like to name these files
# User-defined Function (UDF)
processLine(){
line="$@" # get all args
index=$(echo $line | gawk -F::: '{ print $1 }')
content=$(echo $line | gawk -F::: '{ print $2 }')
# Let's tr it to remove double-quotes(42) and lfs(12)!
content=$(echo $content | tr -d \012)
content=$(echo $content | tr -d \042)
content=$(echo $content | tr -d \054)
# - THEN APPEND THE LINE to OUTPUT FILE
echo $index','$content>>OUTPUT
# - ALSO, save 'raw' individual student data as a backup
echo $content>STUDENTS/STUDENT.$index
}
Yes, I know, that tr stuff is poorly written! Hey, it's almost my first script!
I'd like to write filenames like STUDENT.7534, not STUDENT."7534" - which can't even be opened.
Hmmm... What to do?