shenwei356 / csvtk

A cross-platform, efficient and practical CSV/TSV toolkit in Golang
http://bioinf.shenwei.me/csvtk
MIT License
992 stars 84 forks source link

Global flag for deleting headers in output? #264

Closed shenwei356 closed 3 months ago

shenwei356 commented 7 months ago

https://github.com/shenwei356/csvtk/issues/258#issuecomment-1882300347

cbrueffer commented 6 months ago

Related to this, or a more general case, would be a global flag --skip-lines N to skip the first N input lines before processing.

My specific use case is csvtk xlsx2csv where the input file contains a few irrelevant first rows. csvkit's in2csv has such a flag (but doesn't let you specify the output delimiter, unlike csvtk, thanks!).

shenwei356 commented 6 months ago

It's relatively easier to implement this now with the current API. But I'm on vacation now. Let me add it to the TODO list.

shenwei356 commented 5 months ago

@cbrueffer what kind of lines do you want to skip?

Do they have the same column number as the left rows?

  1. If yes, that would be simple.
  2. If no, it's difficult to do. One workaround way is csvtk fix | csvtk xxx --skip-rows xx

Do they begin with some special character like #?

  1. If they do, set -C, --comment-char with it.
  2. If no, well, it's difficult.
shenwei356 commented 5 months ago

https://github.com/shenwei356/csvtk/issues/258#issuecomment-1995997824

  • add a new global flag -U, --delete-header for disable outputing the header row. Supported commands: concat, csv2tab/tab2csv, csv2xlsx/xlsx2csv, cut, filter, filter2, freq, fold/unfold, gather, fmtdate, grep, head, join, mutate, mutate2, replace, round, sample.
shenwei356 commented 5 months ago

see https://github.com/shenwei356/csvtk/releases/tag/v0.30.0