Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Example 1:
- $ cat /tmp/test | tr '<\n' '\n<' | paste -sd\\n - - | sed -e'/^[0-9]\{1,\}>/!{$!H;1h;$!d' -e\} -e'x;y/\n</<\n/;s//<&/'
- works as expected. Output:
- <37> Jul 28 10:40:47 127.0.0.1 time="2015-07-28 10:40:47" msg="LOGOUT User admin logged out on TELNET (10.0.200.1)"
- <37> Jul 28 10:45:58 127.0.0.1 time="2015-07-28 10:45:58" msg="LOGIN User admin logged in on TELNET (10.0.200.1)"
- <37> Jul 28 10:40:47 127.0.0.1 time="2015-07-28 10:40:47" msg="LOGOUT User admin logged out on TELNET (10.0.200.1)"
- <37> Jul 28 10:45:58 127.0.0.1 time="2015-07-28 10:45:58" msg="LOGIN User admin logged in on TELNET (10.0.200.1)"
- Example 2:
- In terminal A
- $ socat -u UDP-RECV:4321 STDOUT | tr '<\n' '\n<' | paste -sd\\n - - | sed -e'/^[0-9]\{1,\}>/!{$!H;1h;$!d' -e\} -e'x;y/\n</<\n/;s//<&/'
- In terminal B
- $ cat /tmp/test | netcat -u localhost 4321
- Expected output in terminal A, got nothing. Running just "socat -u UDP-RECV:4321 STDOUT" in terminal A gets output so it isn't a comms issue.
- (intentional uuoc in the examples to express the syle of pipeline being used)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement