[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[K12OSN] script help please (OT)

Hey folks,

I know this won't be much of a challenge for you script gurus, but my skills are woefully inadequate.

I have a user who has to aggregate some data that was given to him in a CSV file. The problem is that the data for each record is split across four lines, and the first item on each line is identical.

What he would like is for the first line to have the next three lines appended to it with the first item stripped out so that when he imports the file into a spreadsheet all the data for each record is on one line.

For example:

19550,"O",1,"01","First","Last","S","10304012","M","W", 1992-07-05,12,"07","01","N","6","N","N","1"
19550,"C",1,"003","","1",2004-09-24,"Principal Name","","","","","","","",""
19567,"O",1,"01","First2","Last2","S","10304012","M","W", 1992-07-05,12,"07","01","N","6","N","N","1"
19567,"C",1,"003","","1",2004-10-04,"Principal Name","","","","","","","",""
19581,"O",1,"01","First3","Last3","S","970402","M","B", 1992-08-31,12,"06","01","N","6","N","N","1"
19581,"C",1,"003","","1",2004-10-05,"Principal Name","","","","","","","",""

so basically remove the 2nd, 3rd, and 4th instances of 19550 and add the result onto the end of the first line.
remove the 2nd, 3rd, and 4th instances of 19567 (6th, 7th, and 8th lines) and add the result onto the end of the fifth line.


19550,"I","2004-2005","190","304",2004-09-24,"N","N","O", 1,"01","First","Last","S","10304012","M","W", 1992-07-05,12,"07","01","N","6","N","N","1","A", 1,"42","18","","","","C",1,"003","","1",2004-09-24,"Principal Name","","","","","","","",""
19567,"I","2004-2005","190","304",2004-10-01,"N","N","O", 1,"01","First2","Last2","S","10304012","M","W", 1992-07-05,12,"07","01","N","6","N","N","1","A", 1,"36","18","","","","C",1,"003","","1",2004-10-04,"Principal Name","","","","","","","",""
19581,"I","2004-2005","190","304",2004-10-04,"N","N","O", 1,"01","First3","Last3","S","970402","M","B", 1992-08-31,12,"06","01","N","6","N","N","1","A", 1,"32","18","","","","C",1,"003","","1",2004-10-05,"Principal Name","","","","","","","",""

If anyone can spare a few minutes or would enjoy showing off their scripting skills, I'd appreciate it.

Thank you,
Jimmy Schwankl


Always proofread carefully to see if you any words out.

**This message was sent from the Chatham County Schools Mail Server**
*****All e-mail correspondence to and from this address is subject to the North Carolina Public Records Law, which may result in monitoring and disclosure to third parties, including law enforcement.*****

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]