I am working on a project in which I need to have portions of a data file read into variables (last name, first name, room, etc) to be displayed in a paragraph, which is then looped until every name is covered.
The datafile is:
James,Robert,M,E162K,5101 Evergreen, Dearborn,Mi,48128
Fulton,Brent,M,E162I,5101 Evergreen, Dearborn,Mi,48128
Conner,Marrci,F,P262J,5101 Evergreen, Dearborn,Mi,48128
Conti,Anthony,M,P252F,5101 Evergreen, Dearborn,Mi,48128
And it needs to be fed into the following text: Where the variables listed are replaced with the corresponding names:
echo "Dear Mr/Mrs. $lastName" >>project2.output
echo "Welcome to Widgets, Inc. $firstName. This letter is to inform you of your assigned office space at
Widgets, Inc. is in the main $building building. Your office is $room located at 5101 Evergreen,
Dearborn Mi. 48121.
I am not sure how to do this so any help would be much appreciated!
echo
statements, I'm guessing you are looking at a shell script, maybebash
. In which case, something likewhile IFS=, read lname fname initial room address city state zip; do ..... done < input.txt
is probably a good place to start