I have a question that involves the bash scripting language.
I have multiple directories
/studentName/studentMail/studentNumber
In each of these directories is a file name.txt, mail.txt, number.txt.
Now I need to create a function that will do the same as the SELECT function of a MySQL database. It doesn't need to read a single line. Just display all contents of those 3 files and sort them. which means i need something like this as output.
studentname | studentmail | studentnumber
I came up with 2 ways.
first:
cat /studentName/name.txt /studentMail/mail.txt /studentNumber/number.txt > summary
cat summary
This will display all contents of the 3 files under each other, which is obviously not good.
I also came up with this:
paste /studentName/name.txt /studentMail/mail.txt /studentNumber/number.txt
This does display all contents but still not really sorted. And I also later on need to be able to only select 1 row to be displayed.
Can anybody help me do this?
PS: I know about sort, but then all contents get displayed under each other, somehow I am not doing it right?