partition file into files with n rows each (except for last file) #1819
-
It would be nice if qsv partition We can already do that like this provided we set the format to have sufficient https://raw.githubusercontent.com/dathere/qsv-lookup-tables/main/lookup-tables/us-states-example.csv This is the code
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 1 reply
-
I had to tweak your code a bit to get it to work on my end:
Anyway, have you tried combining Here's a small shell script I pulled together using the two commands: partsplit.sh
Running it against this file: https://raw.githubusercontent.com/dathere/qsv-lookup-tables/main/lookup-tables/BLS_SeriesID.csv I split each partitioned CSV into 10-row CSVs in their own split directories...
|
Beta Was this translation helpful? Give feedback.
-
I am on Windows so your script won't work for me. A flag on partition would be ideal but if not I don't think I would want something as complex as writing loops or being so dependent on shell scripting. One additional problem that this brings out, although I have noticed it before, is that if one is trying to do this across different platforms, shells, etc. the use of qsv may have to be adapted to each. |
Beta Was this translation helpful? Give feedback.
-
Yep - my daily driver is macOS, and we deploy on Ubuntu Linux 22.04 LTS, so it really gets exercised in those environments. But it should work on WSL or Cygwin as is. I asked Gemini to port the script to Powershell, should you want to try it out (haven't tested though it as I don't have ready access to Windows):
partsplit.ps1
And as for running across different platforms consistently using a GUI environment - that's one of the main reasons why we built qsv-pro. Give it a try - we can extend the license key after the trial too... |
Beta Was this translation helpful? Give feedback.
-
Powershell would not work for me because the default for Windows is that it will not run any Powershell scripts. That means I can't give it to a noob without them getting into Windows administration which is a whole new level of complexity. I also can't use non-free software. |
Beta Was this translation helpful? Give feedback.
-
GNU split actually does what I was describing although it does not deal with csv headers.
|
Beta Was this translation helpful? Give feedback.
-
Another solution without using a shell script is using |
Beta Was this translation helpful? Give feedback.
-
Converting this issue to a discussion, which IMHO, is more appropriate... |
Beta Was this translation helpful? Give feedback.
-
Sorry. Didn't notice |
Beta Was this translation helpful? Give feedback.
Sorry. Didn't notice
split
. Maybesplit
andpartition
could be combined or if not the documentation could cross reference them.