Skip to content

Instantly share code, notes, and snippets.

@sanguis
Created September 2, 2015 14:36
Show Gist options
  • Save sanguis/3751f1fa2274dfcd1721 to your computer and use it in GitHub Desktop.
Save sanguis/3751f1fa2274dfcd1721 to your computer and use it in GitHub Desktop.
a quck and dirty script splits a file by line numbers: use input order $file $prefix $linenumbers
#!/bin/bash
mkdir $1
cd $1
split -l $2 ../$0 $1
find . -type f -exec mv '{}' '{}'.csv \;
cd ..
@sanguis
Copy link
Author

sanguis commented Sep 2, 2015

download this file with

wget https://gist.github.com/sanguis/3751f1fa2274dfcd1721/raw/11409610e9cfe30d20b79415fb1b593b9058ded7/split_by_line.bash

run it with

bash split_by_line.bash NLineNumbers FILE PREFIX

example

bash split_by_line.bash 1000 foo.csv foo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment