I have a file that looks like this:
FILE1:
0/28
7200/11
14400/11
21584/28
21600/11
28800/28
36000/11
36000/28
43200/11
43200/28
50400/11
57600/11
79200/28
In the left part (before / ) I have the time in seconds, and in the right part I have a value for a parameter at that respective second.
Now I have another file that looks like this:
FILE2:
0 14
0 15
0 20
0 28
7200 11
7200 14
7200 15
Now, I want to remove from the second file the common values from FILE1. For example I should remove from FILE2:
0 28
7200 11
and keep the rest of the lines as they are.
I was thinking to use a for loop in a bash script for each line in FILE1 and then search for that in FILE2, but I can't manage to recognize the pattern. If I try to use substr from awk it won't work because the time does not have the same digits (0 has 1 digit and 7200 has 4).
To read FILE1 I am doing something like this:
IFS=$'\n' read -d '' -r -a X < ./FILE1.csv
And to write the for loop I am doing something like this:
for x in "${X[@]}"
do
gawk -i inplace -v var=${x} '{...}' FILE2.csv
done
I am also thinking to transform FILE1 in something like this:
0 28
7200 11
14400 11
21584 28
21600 11
28800 28
36000 11
36000 28
43200 11
43200 28
50400 11
57600 11
79200 28
to have basically 2 columns, but using the for as I used it above and var, won't work if I have more than 1 column. I think this second approach is better, but I have no idea how to make it process each column individually.
EDIT:
How would I do that if FILE1 is:
0 28
7200 11
14400 11
21584 28
21600 11
28800 28
36000 11
36000 28
43200 11
43200 28
50400 11
57600 11
79200 28
and FILE2 is:
0 14 2 19
0 15 157 67
0 20 28 57
0 28 25 67
7200 11 88 14
7200 14 34 247
7200 15 364 14