显示ore在以地点名称结尾的地点工作的所有员工的详细信息
EmpID:Name:Designation:UnitName:Location:DateofJoining:Salary
1001:Thomson:SE:IVS:Mumbai:10-Feb-1999:60000
1002:Johnson:TE::Bangalore:18-Jun-2000:50000
1003:Jackson:DM:IMS:Hyderabad:23-Apr-1985:90000
1004:BobGL::ETA:Mumbai:05-Jan-2004:55000
1005:Alice:PA:::26-Aug-2014:25000
1006:LilySE:IVS::Bangalore:17-Dec-2015:40000
1007:Kirsten:PM:IMS:Mumbai:26-Aug-2014:45000
1004:BobGL::ETA:Mumbai:05-Jan-2021:55000
Run Code Online (Sandbox Code Playgroud)
预期输出:
1002:Johnson:TE::Bangalore:18-Jun-2000:50000
1006:LilySE:IVS::Bangalore:17-Dec-2015:40000
Run Code Online (Sandbox Code Playgroud)
这是我试过的代码,它只显示位置,但我想要完整的细节
cut -d ":" -f4 employee.txt | grep 'ore\>'
Run Code Online (Sandbox Code Playgroud)
编辑:已解决
grep "`cut -d ":" -f5 employee.txt | grep 'ore\>'`$" employee.txt
Run Code Online (Sandbox Code Playgroud)
得到输出:
1002:Johnson:TE::Bangalore:18-Jun-2000:50000
1006:LilySE:IVS::Bangalore:17-Dec-2015:40000
Run Code Online (Sandbox Code Playgroud)
谢谢大家的帮助:)