【发布时间】:2012-12-26 08:46:18
【问题描述】:
我在 sed 中使用正则表达式时遇到了问题。 我有一个像这样的字符串:
Call stack: [thread 0xac0aaa28]: | start | main main.m:37 | UIApplicationMain | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSource1 | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ | mshMIGPerform | _XCopyAttributeValue | _AXXMIGCopyAttributeValue | _copyAttributeValueCallback | -[NSObject(AXPrivCategory) accessibilityAttributeValue:] | -[UITableViewCellAccessibilityElement _accessibilityIsTableCell] | -[UITableViewCellAccessibilityElement tableViewCell] | -[UITableViewAccessibility(Accessibility) accessibilityCellForRowAtIndexPath:] | -[UITableView(UITableViewInternal) _createPreparedCellForRowAtIndexPath:] | -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] | -[MailViewController tableView:cellForRowAtIndexPath:] | +[NICellFactory tableViewModel:cellForTableView:atIndexPath:withObject:] NICellFactory.m:89 | +[NICellFactory cellWithClass:tableView:object:] NICellFactory.m:67 | -[SwipableTableViewCell shouldUpdateCellWithObject:] | -[SwipableTableViewCell updateCellWithObject:] | -[ThreadCellFrontView updateCellWithObject:] | -[ThreadSummaryView updateWithNugget:] | -[JavaUtilLinkedList init] LinkedList.m:49 | -[JavaUtilLinkedList initJavaUtilLinkedList] LinkedList.m:40 | +[NSObject alloc] | +[NSObject allocWithZone:] | _objc_rootAllocWithZone | class_createInstance | calloc | malloc_zone_calloc
具有 main.m:37 |、LinkedList.m:95 |、NICellFactory.mm:89 | 等实例ETC 即在文本伴侣中,我可以使用正则表达式匹配这些出现
[a-zA-z]+[.][m]+[:]+[0-9]+[ |]+
现在,当我尝试在 sed 中使用
做同样的事情时sed 's/\[a-zA-z]+[.][m]+[:]+[0-9][ |]+/ /g'
Sed 似乎没有取代这些实例。 我也尝试过使用反冲 即
sed 's/\[a-zA-z\]+\[\.\]\[m\]+\[:\]+\[0-9\]+\[ |\]+/ /g'
仍然 sed 不能替代此类事件。
谁能帮我理解我做错了什么?
谢谢
【问题讨论】: