所以我试图使用" uinq"来打印一个独特的输出。在bash中实用,但它似乎对我没用。
这是我的文件,其中包含以下内容: -
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd89f794bc0 [0x7fff9e7e6980]> { URL = "lspcidrv.kext/ -- file:///Library/Extensions/", ID = "com.evosx86.driver.lspcidrv" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a1646250 [0x7fff9e7e6980]> { URL = "ACPIPoller.kext/ -- file:///Library/Extensions/", ID = "com.rehabman.driver.ACPIPoller" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a1639640 [0x7fff9e7e6980]> { URL = "ACPIBatteryManager.kext/ -- file:///Library/Extensions/", ID = "org.rehabman.driver.AppleSmartBatteryManager" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd89f68ec60 [0x7fff9e7e6980]> { URL = "USBInjectAll.kext/ -- file:///System/Library/Extensions/", ID = "com.rehabman.driver.USBInjectAll" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a1624500 [0x7fff9e7e6980]> { URL = "RealtekRTL8111.kext/ -- file:///System/Library/Extensions/", ID = "com.insanelymac.RealtekRTL8111" }
Kext with invalid signatured (-67054) allowed: <OSKext 0x7fd8a14f00c0 [0x7fff9e7e6980]> { URL = "X86PlatformPlugin.kext/ -- file:///System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/", ID = "com.apple.driver.X86PlatformPlugin" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a15b45f0 [0x7fff9e7e6980]> { URL = "FakeSMC_LPCSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.LPCSensors" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a15a5f10 [0x7fff9e7e6980]> { URL = "FakeSMC.kext/ -- file:///System/Library/Extensions/", ID = "org.netkas.driver.FakeSMC" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a15b2030 [0x7fff9e7e6980]> { URL = "FakeSMC_CPUSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.CPUSensors" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a15ab6d0 [0x7fff9e7e6980]> { URL = "FakeSMC_ACPISensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.ACPISensors" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a159bfb0 [0x7fff9e7e6980]> { URL = "FakePCIID.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.driver.FakePCIID" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a159f440 [0x7fff9e7e6980]> { URL = "FakePCIID_Intel_HDMI_Audio.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.injector.FakePCIID-Intel-HDMI-Audio" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a159e910 [0x7fff9e7e6980]> { URL = "FakePCIID_Intel_HD_Graphics.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.injector.FakePCIID-Intel-HD-Graphics" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a15480e0 [0x7fff9e7e6980]> { URL = "CodecCommander.kext/ -- file:///System/Library/Extensions/", ID = "org.tw.CodecCommander" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fd8a153eee0 [0x7fff9e7e6980]> { URL = "AsusNBFnKeys.kext/ -- file:///System/Library/Extensions/", ID = "org.emlydinesh.driver.AsusNBFnKeys" }
KernelCache ID: A297C9A0448F4369BE17FFCFB1682182
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc8528c4d0 [0x7fff9e7e6980]> { URL = "AsusNBFnKeys.kext/ -- file:///System/Library/Extensions/", ID = "org.emlydinesh.driver.AsusNBFnKeys" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc8528cc30 [0x7fff9e7e6980]> { URL = "CodecCommander.kext/ -- file:///System/Library/Extensions/", ID = "org.tw.CodecCommander" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc852b3b10 [0x7fff9e7e6980]> { URL = "FakePCIID.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.driver.FakePCIID" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc852b24f0 [0x7fff9e7e6980]> { URL = "FakePCIID_Intel_HD_Graphics.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.injector.FakePCIID-Intel-HD-Graphics" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc852b4a40 [0x7fff9e7e6980]> { URL = "FakePCIID_Intel_HDMI_Audio.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.injector.FakePCIID-Intel-HDMI-Audio" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc852bb520 [0x7fff9e7e6980]> { URL = "FakeSMC.kext/ -- file:///System/Library/Extensions/", ID = "org.netkas.driver.FakeSMC" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc852c0ce0 [0x7fff9e7e6980]> { URL = "FakeSMC_ACPISensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.ACPISensors" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc852c7640 [0x7fff9e7e6980]> { URL = "FakeSMC_CPUSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.CPUSensors" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc852c74e0 [0x7fff9e7e6980]> { URL = "FakeSMC_GPUSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.GPUSensors" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc853f4af0 [0x7fff9e7e6980]> { URL = "FakeSMC_LPCSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.LPCSensors" }
Kext with invalid signatured (-67054) allowed: <OSKext 0x7fdc8516ea40 [0x7fff9e7e6980]> { URL = "X86PlatformPlugin.kext/ -- file:///System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/", ID = "com.apple.driver.X86PlatformPlugin" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc857cb360 [0x7fff9e7e6980]> { URL = "RealtekRTL8111.kext/ -- file:///System/Library/Extensions/", ID = "com.insanelymac.RealtekRTL8111" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc85432aa0 [0x7fff9e7e6980]> { URL = "USBInjectAll.kext/ -- file:///System/Library/Extensions/", ID = "com.rehabman.driver.USBInjectAll" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc82d049c0 [0x7fff9e7e6980]> { URL = "ACPIBatteryManager.kext/ -- file:///Library/Extensions/", ID = "org.rehabman.driver.AppleSmartBatteryManager" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc851c2520 [0x7fff9e7e6980]> { URL = "ACPIPoller.kext/ -- file:///Library/Extensions/", ID = "com.rehabman.driver.ACPIPoller" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fdc851f3f90 [0x7fff9e7e6980]> { URL = "lspcidrv.kext/ -- file:///Library/Extensions/", ID = "com.evosx86.driver.lspcidrv" }
正如你可能已经注意到的除了第8个字段,每个&#34; kext&#34;有一个冗余条目。我尝试使用cat myfile | uniq -f8
,但这不起作用。
任何帮助将不胜感激。
此致
答案 0 :(得分:1)
uniq
要求对其输入进行排序。实现这一点,如下所示:
sed -E -e 's/OSKext 0x[^[:space:]]+ /OSKext ELIDED /g' | sort | uniq
...在stdin输入时产生:
KernelCache ID: A297C9A0448F4369BE17FFCFB1682182
Kext with invalid signatured (-67054) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "X86PlatformPlugin.kext/ -- file:///System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/", ID = "com.apple.driver.X86PlatformPlugin" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "ACPIBatteryManager.kext/ -- file:///Library/Extensions/", ID = "org.rehabman.driver.AppleSmartBatteryManager" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "ACPIPoller.kext/ -- file:///Library/Extensions/", ID = "com.rehabman.driver.ACPIPoller" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "AsusNBFnKeys.kext/ -- file:///System/Library/Extensions/", ID = "org.emlydinesh.driver.AsusNBFnKeys" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "CodecCommander.kext/ -- file:///System/Library/Extensions/", ID = "org.tw.CodecCommander" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakePCIID.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.driver.FakePCIID" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakePCIID_Intel_HDMI_Audio.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.injector.FakePCIID-Intel-HDMI-Audio" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakePCIID_Intel_HD_Graphics.kext/ -- file:///System/Library/Extensions/", ID = "org.rehabman.injector.FakePCIID-Intel-HD-Graphics" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakeSMC.kext/ -- file:///System/Library/Extensions/", ID = "org.netkas.driver.FakeSMC" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakeSMC_ACPISensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.ACPISensors" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakeSMC_CPUSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.CPUSensors" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakeSMC_GPUSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.GPUSensors" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "FakeSMC_LPCSensors.kext/ -- file:///System/Library/Extensions/", ID = "org.hwsensors.driver.LPCSensors" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "RealtekRTL8111.kext/ -- file:///System/Library/Extensions/", ID = "com.insanelymac.RealtekRTL8111" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "USBInjectAll.kext/ -- file:///System/Library/Extensions/", ID = "com.rehabman.driver.USBInjectAll" }
Kext with invalid signatured (-67062) allowed: <OSKext ELIDED [0x7fff9e7e6980]> { URL = "lspcidrv.kext/ -- file:///Library/Extensions/", ID = "com.evosx86.driver.lspcidrv" }
答案 1 :(得分:1)
awk
救援!
不求助于排序(双关语)
$ awk '{k=$8; $8=""} !a[$0]++{$8=k; print}' file | wc -l
17
以输入文件的相同顺序打印唯一条目模数第8个字段。
如果你不想保留这个领域,那就更简单......
$ awk '{$8="REMOVED"} !a[$0]++' file