I am trying to remove a column from a data set. My file looks as below. How can I accomplish this?
Input-
1,2,3,4
2,3,4,5
3,4,5,6
Output-
2,3
3,4
4,5
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no quick way of doing that – you will end up “tokenizing” each line of the file, and then writing only the parts that you want.
If you know that each row contains a fixed number of integers (say, 4, as in your example), and you need to “cut out” several columns from it (say, columns 2 and 3), do this in a loop:
Of course you need to open the files before you start looping, close after you finish it, and test for the end of the input file in your loop condition.