I hope someone here can help me. I have a line in a text file that looks like this:
Jan 8 14:12:56 kernel: SRC=1.2.3.4 DST=255.255.255.255 LEN=104 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=44224 DPT=14000 LEN=84
I want to extract words starting with src =, PROTO = and DPT =. My goal is to get a line that looks something like this:
1.2.3.4 UDP 14000
I would prefer the solution to be bash using sed, awk or similar, if possible.
source
share