Skip to content

Instantly share code, notes, and snippets.

@unixsam
Last active April 20, 2016 16:23
Show Gist options
  • Select an option

  • Save unixsam/d2c9ff0a57ac9a78a222 to your computer and use it in GitHub Desktop.

Select an option

Save unixsam/d2c9ff0a57ac9a78a222 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Change the file name. and the part the file to 1000 lines in each part file.
split -d -l 1000 --additional-suffix=.csv filename.csv files-part-
# Add the heading of the csv file to each parted file.
for file in files-part-*.csv; do
printf '%s\n' 0a file_id,title_text_en,alt_text_en,title_text_ar,alt_text_ar . w | ed -s "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment