I am trying to capture tcpdump in Linux and I used the -C
and -W
option to enable capturing tcpdump with file size limited to 250MB.
sudo tcpdump -i any -s0 -vvv -W 999 -C 250 -w FILENAME.pcap. -Z root
On the other hand, the output I am getting is
FILENAME.pcap.001 FILENAME.pcap.002 FILENAME.pcap.003
But I would like to know how to make the output file name into:
FILENAME001.pcap FILENAME002.pcap FILENAME003.pcap
Thanks for any help you can suggest!
Advertisement
Answer
Tcpdump has no such function built in. You can run something like this in the end to rename your files though:
for f in FILENAME.pcap.*; do mv "$f" "$(echo $f | sed 's/FILENAME.pcap.(.*)/FILENAME1.pcap/')"; done