Programmable column operator problem
Posted: 2021 May 28, 18:01
I am trying to use the programmable column to see if a file consists of one of three specific contents. I want to detect files that contain exactly "|-RGS-|" (without the quotes), "|-LJS'|", and "|-LJS-|-RGS=|". There are no line-end or carriage-return characters in the file.
I have failed to make the GREP function work. In part I suspect that the "|" is troublesome. I cannot find a grep expression that will do an exact compare of the file -- it can find contents within the file, but I cannot get the start-at-the-start ^ operator and the end-at-the-end $ operator to work, possibly because what I am searching for includes "|" and I don't know how to express that. And I also don't know how to express in a single grep expression something that would catch all three exact cases, and without this I fall in to the problem I am actually describing, below.
So I am trying to use fbytes, and here is where there is, as far as I can tell, a bug in the programmable column support. The following expression works well:
(file2("fbytes(0,8)",${Path}+mid(${Name},1,len(${Name})-4)+".tag")="7C.2D.52.47.53.2D.7C")
It gives me a 0 or a 1 as a result. For simplicity let us call the above expression "X". If I put X + X in the programmable column operation field, I get a syntax error "wrong function argument" at the second occurrence of "file2". Likewise if I put X & X in the operation field, or X | X. To make this explicit,
(file2("fbytes(0,8)",${Path}+mid(${Name},1,len(${Name})-4)+".tag")="7C.2D.52.47.53.2D.7C")+(file2("fbytes(0,8)",${Path}+mid(${Name},1,len(${Name})-4)+".tag")="7C.2D.52.47.53.2D.7C")
gives a syntax error, and I don't know why.
Any thoughts? or, even better, a better and more elegant solution to what I am trying to do?
I have failed to make the GREP function work. In part I suspect that the "|" is troublesome. I cannot find a grep expression that will do an exact compare of the file -- it can find contents within the file, but I cannot get the start-at-the-start ^ operator and the end-at-the-end $ operator to work, possibly because what I am searching for includes "|" and I don't know how to express that. And I also don't know how to express in a single grep expression something that would catch all three exact cases, and without this I fall in to the problem I am actually describing, below.
So I am trying to use fbytes, and here is where there is, as far as I can tell, a bug in the programmable column support. The following expression works well:
(file2("fbytes(0,8)",${Path}+mid(${Name},1,len(${Name})-4)+".tag")="7C.2D.52.47.53.2D.7C")
It gives me a 0 or a 1 as a result. For simplicity let us call the above expression "X". If I put X + X in the programmable column operation field, I get a syntax error "wrong function argument" at the second occurrence of "file2". Likewise if I put X & X in the operation field, or X | X. To make this explicit,
(file2("fbytes(0,8)",${Path}+mid(${Name},1,len(${Name})-4)+".tag")="7C.2D.52.47.53.2D.7C")+(file2("fbytes(0,8)",${Path}+mid(${Name},1,len(${Name})-4)+".tag")="7C.2D.52.47.53.2D.7C")
gives a syntax error, and I don't know why.
Any thoughts? or, even better, a better and more elegant solution to what I am trying to do?