Given a text file named file like this:
AAA 3/4 2/2 3/5
BBB 3/4 2/3 3/3 6/7
CCC 4/4 7/9
What should I do to get just the numerator of each fraction? like following:
AAA 3 2 2
BBB 3 2 3 6
CCC 4 7
Thank you.
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.
Idea is to match any fraction and get only numerator from each one. So, fraction is (numbers)
/(numbers) . Using groups it’s easy to get what you want.