Bash Programming. Could anyone help me?

Hi! I'm new in bash programming and I need to make an script that reads a txt file line by line (every line is like "Name;FirstLastName;SecondLastName;Sex") and has to give every student 3 random marks, its average and add a counter if they are male/female and if they passed. I've been trying with the "read while" function but i don't know how to do the script. Could anyone help or explain me how it works or how should I do this? I would be very grateful. :slight_smile:

Post Edition: Output needs to be a new txt, not the same.

Welcome to Forums,

Is this homework/assignment? There are specific forums for these.

What have you tried so far?

What output/errors do you get?

1 Like

This explains how to read a file line-by-line. Pay attention to the non-whitespace delimiter example.

BashFAQ/001 - Greg's Wiki

1 Like

Yes, this is homework. Sorry, I did't know there are specific forums. I've benn trying the read while function but I only takes every line as a unique value, later I tried to change the IFS but it didn't work. I got no errors, but it does not get the in values correctly separated, so it won't work when I'll try to solve the 2nd part.

Please show what you have tried.

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.

1 Like