String concatenation in bash

The program has an output set to 2 decimal points, one for each line in the file. Depending on the execution, many files can be displayed, each of which has the file name cancer.ex #, where # is the number of times the program was executed from the script.

The professor provided awk script as a first step to creating a 95% trust map using gnuplot. I would like to convert the output to a format

conf $1 $2 $3 var#

where # is the number from cancer.ex #

I developed the following:

#!/bin/bash
Files=Output/*
String

for f in $Files 
do
    String="conf "
    cat $f | while read LINE
    do
        String="$LINE "
    done
echo $String
done

, , . , . , nada script . , String="$LINE echo $LINE, , .

bash?

+5
1
#!/bin/bash
Files=( Output/* )
String

for f in "${Files[@]}"
do
    String="conf "
    while read LINE
    do
        String+="$LINE "
    done < "$f"
echo $String
done

< "$f" piping cat $f , while - , for - .

, ( , )

?

, ,

String="conf $(cat Output/*)"
#
String="$(for a in Output/*; do echo "conf $(cat "$a")"; done)"

:

mkdir Dummy
for a in {a..f}; do for b in {1..3}; do echo $a $b; done > Dummy/$a; done
for a in Dummy/*; do echo "conf " $(cat $a); done

conf  a 1 a 2 a 3
conf  b 1 b 2 b 3
conf  c 1 c 2 c 3
conf  d 1 d 2 d 3
conf  e 1 e 2 e 3
conf  f 1 f 2 f 3
+7

All Articles