Is there a way to send file content difference from Redhat to a server listening on a specific IP/Port on Windows? I initially thought tail -f command but then comes the IP part, anyone can help me?
Asked
Active
Viewed 51 times
1 Answers
5
You should be able to use nc(1) to do this e.g.
tail -f /var/log/messages | nc 192.0.2.1 -p 39993
Which will send the output from the tail command to port 39993 on the system at 192.0.2.1.

user9517
- 115,471
- 20
- 215
- 297
-
Of course, this will need something to be actually listening on that port on the remote system and append whatever it receives to its copy of the file; a `nc` Windows port will suffice. – Massimo Jan 07 '19 at 22:16
-
Also, this will only work for new lines which get appended to the original file, not for any true difference such as changing something that's already there. – Massimo Jan 07 '19 at 22:17
-
That is what I am trying to achieve, only the new lines to be transferred, so it is great. Can I stream the tail in a string format instead of file format? I have a server on Windows client listening for string on a specified IP/Port. What I want to do is, on my Red Hat machine, whenever a file is changed, I want to tail it and send the difference to my Windows server in string format, then server will parse string and use it to create objects. – maxjoy Jan 08 '19 at 05:26
-
Thank you, I added some commands to adjust and your help was great! – maxjoy Jan 09 '19 at 13:33
-
@Massimo thank you for needlessly stating the obvious. – user9517 Jan 11 '19 at 20:58
-
@Iain if you read maxjoy's comments, maybe it's not that obvious ("whenever a file is changed, I want to tail it and send the difference to my Windows server in string format, then server will parse string and use it to create objects"). Anyway, no offense intended, and of course `nc` can help here... if that's what you need. – Massimo Jan 12 '19 at 00:59