Need Help with Code

Hey guys, I need help with a coding assignment for a class. Its been almost 3 years since I’ve last touched a coding program, so I’m a little rusty, and would like some help getting started.

For my assignment, I have to write a program that reads in lines of input, redirects files, process those files, and then outputs the results on a Linux server.

Does anyone know how to do this? I’ve had some experience with C++ and Java, but I’ve never once touched Linux or know about Linux commands.

This is a pretty vague request, what exactly do you meant “output the result”?
You want to save a file there, echo a command…

Also do you have permission to read-write on that server?

That said cat is a shell command to read a content of a file
so

cat /path/to/file

will display the content of the file on the screen.
You can also write the content of the file into a new file

cat /path/to/file > /temp/file.txt

You can then concatenate command as:

<file> | ssh user@Server "cat > output.txt"

more on cat

Good luck with your assignment :slight_smile:

Thanks! Here’s a direct quote from the assignment on the request:

You are to write a program that reads in lines of input using scanf, and file redirection, process the data, and then output
the results using printf.

The data:

  1. Each line of the data file begins with an ‘e’, ‘c’, or ‘t’.
  2. Lines beginning with ‘e’ will have an integer employee ID and an employee name.
  3. Lines beginning with ‘c’ will have an integer customer ID, customer name, and a floating point account balance.
  4. Lines beginning with a ‘t’ will have a customer ID, employee ID, a ‘w’ or ‘d’ representing withdrawal or deposit,
    and a floating point transaction amount.
  5. Lines beginning with an ‘e’ and ‘c’ may be intermingled, but all ‘e’ and ‘c’ lines will come before lines beginning
    with ‘t’.
  6. There will be at most 50 employees and 50 customers, and an unknown number of transactions. Names will be at
    most 15 characters long.

I understand most of it, all that’s confusing to me is the file redirection using Linux servers. Everything else sort of makes sense, but if someone would like to give me an idea of how to get started, I’d appreciate it a lot.