14.04 - split file renaming automation - Ask Ubuntu


after split file want name them so. how can automate this?

2048  split -l 500000 10k_edges_sixth_1000.csv  2049  ls -ltr  2050  mv xaa 10k_edges_sixth_1000_pt1.csv  2051  mv xab 10k_edges_sixth_1000_pt2.csv  2052  mv xac 10k_edges_sixth_1000_pt3.csv  2053  mv xad 10k_edges_sixth_1000_pt4.csv  2054  mv xae 10k_edges_sixth_1000_pt5.csv  2055  mv xaf 10k_edges_sixth_1000_pt6.csv  2056  mv xag 10k_edges_sixth_1000_pt7.csv  2057  mv xah 10k_edges_sixth_1000_pt8.csv  2058  mv xai 10k_edges_sixth_1000_pt9.csv 

solution

this command should work:

split -l 500000 -d --additional-suffix='.csv' 10k_edges_sixth_1000.csv 10k_edges_sixth_1000_pt 

explanations flags

  • -l flag: number of lines per output file.

  • -d flag: force use of numeric suffixes.

  • --additional-suffix flag: adds user-specified additional suffix end of file name after numeric suffix (if enabled).


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User