There is a similar post, but this one is slightly different. I have a csv file in which the second column contains some alphanumeric data. I need to delete this entire column and replace it with a new one. I need to do this for many files in the same directory. The files are named treatables-000.csv, treatables-001.csv, and so one. Here's an example : Original file:

 t ,  group,     1
aaa,  baddata1,  bbb
aab,  baddata1,  bbc
aaad  baddata2   bbb 

Column 2 needs to be replaced with the columnp1,p2,p3,... p20,p1,p2,... It should be of the same length as the original. How can I do this using the command line? The files may all be of different length.

  • It's not clear what the second column should be replaced with, what's the criterium to determine p1,p2,p3 and the successive values? – kos Oct 29 '15 at 0:51
  • 4
    You are not the only student taking this course. A very similar question was asked previously here: unix.stackexchange.com/questions/239311/… – John1024 Oct 29 '15 at 1:12
  • 1
    @John1024 Technically it's also the same student. Flagged for closure. – kos Oct 29 '15 at 1:15
  • 2
    Anyway this question looks exactly like your first one, or at least the answer is going to be the same. If someone already casted a close vote you should agree with the close vote and let this question be closed. I'll post my answer on the other question if you're not happy with the answer you currently have there. – kos Oct 29 '15 at 1:21
  • 1
    I posted my answer in your other question, since although the question are apparently slightly different they're not enough to require a different answer. – kos Oct 29 '15 at 1:33

Browse other questions tagged or ask your own question.