RANK NAME BAND YEAR GENERE DOMESTIC/INTERNATIONAL
206:Reach Out, I'll Be There:The Four Tops:1978:Pop:3/2
207:Bye Bye Love:The Everly Brothers:1950:Classic:3/2
208:Gloria:Them:1965:Classic:1/1
209:In My Room:The Beach Boys:1985:Classic:5/7
210:96 Tears:? & the Mysterians:1964:Classic:20/15
211:Caroline, No:The Beach Boys:1975:Classic:5/7
212:1999:Prince:1958:Classic:5/7
213:Your Cheatin' Heart:Hank Williams:1988:Soul:7/6
214:Rockin' in the Free World:Neil Young:1960:Pop:5/7
215:Sh-Boom:The Chords:1967:Alternative:3/2
216:Do You Believe in Magic:The Lovin' Spoonful:1988:Classic
217:Jolene:Dolly Parton:1998:Classic:7/6
218:Boom Boom:John Lee Hooker:1966:Classic:7/6
1st I tried to print a list of Rank, performers and songs with header so I tried:
but the output still have the default header under the line
nawk 'BEGIN { FS=":"
printf "%-10s %-35s %-55s\n", "RANK", "PERFORMER","SONG"
print "=====================================================================\n"}
{printf "%-10s %-35s %-55s\n", $1, $3, $2}' songs
我没有计算每种类型的歌曲数量并报告每种类型的总数
期望的输出是示例:
经典10
R&B 5
灵魂9等..
我试过了
awk '{count+$5} END {print $5}'
歌曲,但它没有返回结果
第一次我尝试用标题打印Rank,表演者和歌曲列表,所以我尝试了:但是输出仍然有nawk行下的默认标题'BEGIN {FS =“:”printf“%-10s%-35s%-55s \ n“,”RANK“,”PERFORMER“,”SONG“打印”================================= ==================================== \ n“} {printf”%-10s%-35s% -55s \ n“,$ 1,$ 3,$ 2}'歌曲
—
Intermd11年