Ask Your Question
0

How to export file name using T fields

asked 2022-09-15 00:30:37 +0000

Rooster_50 gravatar image

I am using a "for" loop to process a file set exporting several fields using -T fields -e <display field=""> out to a text file. Is it possible to somehow export the name of the file with each processed line so that I know which file in the set it is from?

Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-09-15 03:09:01 +0000

Jim Young gravatar image

You didn't say what OS you are using. If you are using a *nix system with something like bash or zsh and your input filename is the variable you are looping across you should be able to pipe your tshark output to sed to prepend the filename to the output. Such as:

tshark -r "$i" -T fields -e frame.number -e frame.time | sed "s/^/$i: /"
edit flag offensive delete link more

Comments

I'm using Windows 10, but using WSL Ubuntu. That worked like a champ! Thanks!

Rooster_50 gravatar imageRooster_50 ( 2022-09-15 03:18:49 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-09-15 00:30:37 +0000

Seen: 182 times

Last updated: Sep 15 '22