Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It is best if you can define an end condition when the capture ends on its own.
Doing a ^c stops capture but doesn't write a complete last packet captured.
Defining a finish condition get the final "]" to match the opening "[".

tshark -Tjson -c 10 | tr -d '\n' > json.out
cat json.out | sed -e "s/},  {/},\n  {/g" > json2.out

It is best if you can define an end condition when where the capture ends on its own.
Doing a ^c stops capture but doesn't write a complete last packet captured.
Defining a finish condition get the final "]" to match the opening "[".

tshark -Tjson -c 10 | tr -d '\n' > json.out
cat json.out | sed -e "s/},  {/},\n  {/g" > json2.out