Hi! I'm trying to take multiple text files (6), which have text on some lines but not others, and combine them. I'd also like to make the values in one column of some of the files (files 4-6) negative. I'm trying to write a short script (see below) as I have to do this with a large number of files. Any advice much appreciated! Example:
Input text file 1:
0 1.3 1
34 4 1
.....
Input text file 2:
10 0.3 1
24 3 1
.....
Output text file:
0 1.3 1
34 4 1
.....
10 0.3 -1
24 3 -1
.....
What I have so far follows. problems: it does not get rid of the rows of empty text (it puts 0.000 in them), and it doesn't work consistently (sometimes it only takes the first line of an input file and ignores the others).
#!/bin/bash
awk '{printf("%f %f %f\n", $1, $2, $3)}' *positive_files*.txt > file_1.txt
awk '{printf("%f %f -%f\n", $1, $2, $3)}' *negative_files*txt >> file_1.txt