Hi every one,
some one can help to can we get data text last line?
type or paste code here
Hi every one,
some one can help to can we get data text last line?
type or paste code here
[{"id":"62cbc6a05fce0d52","type":"file in","z":"847e8dec2e664a26","name":"","filename":"payload","filenameType":"msg","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":280,"y":280,"wires":[["40fd65138cd46e18"]]}]
You have posted 1 single file node - not much use to anyone.
Please provide all the info a person would need to be able to help you.
Do you mean you want to fetch just the last line of a file?
If so then search the forum for
last line of file
Thanks Steve , when have file(text) incomming in single file need to read last line and get this line text
[{"id":"847e8dec2e664a26","type":"tab","label":"Flow 3","disabled":false,"info":"","env":},{"id":"e2661aa99a5ac377","type":"debug","z":"847e8dec2e664a26","name":"got ... blocks + bytes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":200,"wires":},{"id":"62cbc6a05fce0d52","type":"file in","z":"847e8dec2e664a26","name":"","filename":"payload","filenameType":"msg","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":280,"y":280,"wires":[["40fd65138cd46e18"]]},{"id":"dfad79e0345e0987","type":"inject","z":"847e8dec2e664a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2022-10-7 8:15:44 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:46 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:48 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:49 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:50 07.10.22 08:17:47 Actuator failed to move on Start command","payloadType":"str","x":130,"y":220,"wires":[["62cbc6a05fce0d52"]]},{"id":"40fd65138cd46e18","type":"string","z":"847e8dec2e664a26","name":"","methods":[{"name":"getRightMost","params":[{"type":"str","value":"20"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":450,"y":280,"wires":[["e2661aa99a5ac377"]]}]
[{"id":"847e8dec2e664a26","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"e2661aa99a5ac377","type":"debug","z":"847e8dec2e664a26","name":"got ... blocks + bytes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":200,"wires":[]},{"id":"62cbc6a05fce0d52","type":"file in","z":"847e8dec2e664a26","name":"","filename":"payload","filenameType":"msg","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":280,"y":280,"wires":[["40fd65138cd46e18"]]},{"id":"dfad79e0345e0987","type":"inject","z":"847e8dec2e664a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2022-10-7 8:15:44 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:46 07.10.22 08:15:40 Actuator failed to move on Start command 2022-10-7 8:15:48 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:49 07.10.22 08:17:47 Actuator failed to move on Start command 2022-10-7 8:17:50 07.10.22 08:17:47 Actuator failed to move on Start command","payloadType":"str","x":130,"y":220,"wires":[["62cbc6a05fce0d52"]]},{"id":"40fd65138cd46e18","type":"string","z":"847e8dec2e664a26","name":"","methods":[{"name":"getRightMost","params":[{"type":"str","value":"20"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":450,"y":280,"wires":[["e2661aa99a5ac377"]]}]
Did the forum search not suggest how to do it?
Yes, not seeing this topic
For me, the first hit of Search results for 'last line of file' - Node-RED Forum is CSV file - last line require which appears to be be exactly what you are asking. Probably other hits there also address the issue.
Just to point out that I too found the post that Colin linked to.
I tried the suggestion which seemed most interesting
Or you can set the csv node to "a message per row" and feed it into a trigger node configured like "send nothing"; "extend delay"; "then send the latest msg object"
It turns out that it won't work using the Read File node set to "a message per line" if the last character in the file is \n
- almost universally the case, at least in Linux.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.