我正在尝试打印出一首特定歌曲以及另外 5 首歌曲的所有台词。我是 shell 新手,我必须在以下命令中修复什么问题?
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
awk '{print * "For What It's Worth"} ' songs
awk '/For What It's Worth/, {print $1 $2}' songs
答案1
不确定您尝试的解决方案与您所说的问题有什么关系;如果您的问题描述准确,则以下内容应该有效
awk 'NR==1,/Caroline, No/{print;next};c++<5{print};' file
答案2
sed '/For What It.s Worth/{N;N;N;N;N;q}'