Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Why comma as a column separator #16

Answered by trick77
nfcg asked this question in Q&A
Discussion options

Hi,
In the ipverse/asn-info repo the CSV currently uses comma (,) as a column separator.
This creates a problem in some lines in the description column, as it contains commas.
Why not use a semicolon as a column separator?

You must be logged in to vote

While the bug was fixed in August, existing database entries were not migrated. This has now been corrected. Thanks for the heads-up.

Replies: 5 comments 1 reply

Comment options

Hi, thanks for pointing this out.
The use of a comma as the separator is intentional and mainly historical. This file follows the same format as other established ASN/IP lists, and keeping it identical allows it to be used as a drop-in replacement without requiring changes on the consumer side.
Descriptions containing commas are therefore not expected and should be treated as data issues. I’m happy to fix those, but I’ll need concrete examples.
Could you please point me to the specific entries or line numbers where this causes problems?
Thanks for the feedback.

You must be logged in to vote
1 reply
Comment options

Importing the CSV file to SQLite will throws the error/warning "expected 3 columns but found 4 - extras ignored" and report the lines.
e.g.: sqlite3 as.db -cmd ".import --csv --skip 1 as.csv asn_info" '';
lines.txt: https://gist.github.com/nfcg/703a99659833bd22d974465a9567e0a6 (--skip 1)

I am currently using this command:
sed -E 's/^([^,]+),([^,]+),(.*)$/1,円2,円"3円"/' as.csv > as_fixed.csv
which adds (") to the data in the description column and solving the issue this way....

Comment options

I can't help you with that import but regarding the comma, a quick csvtool col 3 as.csv | grep ',' doesn't show any.

You must be logged in to vote
0 replies
Comment options

That actually was a dumb test, let me have a look at it again.

You must be logged in to vote
0 replies
Comment options

While the bug was fixed in August, existing database entries were not migrated. This has now been corrected. Thanks for the heads-up.

You must be logged in to vote
0 replies
Answer selected by nfcg
Comment options

Btw. the list gets exported to JSON too now if you don't like (faulty) CSV's.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /