First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

A pcap to csv which seperator to choose

  • retag add tags

I am trying to put some tshark output into a csv file, which is not that hard with " [...]>> file.csv"

But the problem is which separator to choose with "-E separator=[??}". Default is "," but this is also in the output data, so that causes problems, same with ";".

So which is the best, safest, unique separator to choose when converting into csv?

rnb's avatar
3
rnb
asked 2022-12-09 12:51:52 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

The -E separator sets the separator and the default is a tab.
The -E aggregator is used when grouping a field. The default value is a comma, which can be altered too.

Personally I would use -E "separator=;" (note: quoted to avoid shell interpretation) and leave the aggregator as is. Most applications (e.g. Excel) will import this just as easy and avoids decimal point issues in different languages.

You can also use -E quote=d to force quoting all fields, in case some contains a separator or an aggregator character.

André's avatar
176
André
answered 2022-12-09 18:46:19 +0000, updated 2022-12-09 18:50:59 +0000
edit flag offensive 0 remove flag delete link

Comments

Doesn't Wireshark deliver quoted strings in CSV output?

hugo.vanderkooij's avatar hugo.vanderkooij (2022-12-12 07:53:26 +0000) edit

tshark -T fields -e ip.addr without -E quote=d will output unquoted IP addresses (aggregated by comma). At least on Windows and Linux, I cannot check MacOS.

André's avatar André (2022-12-12 17:30:05 +0000) edit

Thank you for your answer, but unfortunately the -E "separator=;" doesn't work for me. There are already a lot of ";" in the data and these also get interpreted as separators. So I am looking for something unique of something smart.

What also doesn't help, is that I want to view the data in Excel, which gives it's own stupid interpretation of the data and quotes when used.

rnb's avatar rnb (2022-12-16 15:18:01 +0000) edit

In case of Excel, there are several options to import a custom CSV file, thus set the delimiter and quotes usage. For example:

  • Via menu Data | From Text/CSV
  • Via menu Data | Text to Columns | Delimited, set delimiter and text qualifier. When pasting the plain (CSV) text it will be split accordingly.

You can use any character you want as a delimiter in both Excel as -E quote option. The default tab character works fine too.

André's avatar André (2022-12-23 20:13:29 +0000) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer