Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

read only one word in unix scripting using the read command. this is what i have

ID: 3568302 • Letter: R

Question

read only one word in unix scripting using the read command.

this is what i have so far however its reading the whole file.

file="location of file"

while read -r word1

do

echo "$word1"

done<"file"

3) The contents of the input data file is shown below Contents of the data file: Clive Cussler,Ghost Ship,9780399167317 Clive Cussler,Bootlegger,9780399167294 James Patterson,Invisible,9780316405348 James Patterson,Gone,9781455515844 James Rollins,Map of Bones,9780062017857 Michael Connelly,The Lincoln Lawyer,9781455516346 David Baldacci, The Escape,9781478984344 4) The output should look like: (But sorted by the ISBN Number!) Author Name of Book ISBN Clive Cussler Clive Cussler James Patterson James Patterson James Rollins Michael Connelly David Baldacci Ghost Ship Bootlegger Invisible Gone Map of Bones The Lincoln Lawyer The Escape 978-0399-16731-7 978-0399-16729-4 978-0316-40534-8 978-1455-51584-4 978-0062-01785-7 978-1455-51634-6 978-1478-98434-4

Explanation / Answer

#! /bin/bash

file="test.txt"

while read -r word1

do

echo "$word1" | awk -F',' '{print $1}'


done<"$file"