【发布时间】:2016-03-27 12:02:37
【问题描述】:
我有一个包含数百个单词的文件。 文件的某些部分包含以下划线 (_) 开头并用逗号 (,) 分隔的单词。我只想找到以逗号分隔的下划线开头的单词并将其保存在某个数组中。我该怎么做?
I tried cat <filename> grep _*
但它列出了行而不是单词。
示例文件(Apple 的 tbd 文件)。我想获取以下划线开头的单词列表
archs: [ armv7, armv7s, arm64 ]
platform: ios
install-name: /System/Library/Frameworks/AVFoundation.framework/AVFoundation
current-version: 2.0
objc-constraint: retain_release
exports:
- archs: [ armv7, armv7s, arm64 ]
re-exports: [ /System/Library/Frameworks/AVFoundation.framework/libAVFAudio.dylib ]
symbols: [ _AVAssetAssociatedSubtitlesTrackReferencesKey, _AVAssetChapterListTrackReferencesKey,
_AVAssetChapterMetadataGroupsDidChangeNotification,
_AVAssetDownloadSessionAirPlayAuthorizationInfoKey,
_AVAssetDownloadSessionCachePrimingDownloadTokenKey,
_AVAssetDownloadSessionClientAuditTokenKey, _AVAssetDownloadSessionClientBundleIdentifierKey,
_AVAssetDownloadSessionCurrentLoadedTimeRangesKey,
_AVAssetDownloadSessionDeleteDownloadWhenAssetFinalizesKey,
_AVAssetDownloadSessionDidResolveMediaSelectionNotification,
_AVAssetDownloadSessionDownloadFailedNotification,
_AVAssetDownloadSessionDownloadSucceededNotification,
_AVAssetDownloadSessionFileSizeAvailableNotification,
_AVAssetDownloadSessionHTTPCookiesKey, _AVAssetDownloadSessionHTTPHeaderFieldsKey,
_AVAssetDownloadSessionLoadedTimeRangesChangedNotification,
_AVAssetDownloadSessionMaxSizeAllowedForCellularAccessKey,
_AVAssetDownloadSessionMediaSelectionKey, _AVAssetDownloadSessionMinimumRequiredMediaBitrateKey,
_AVAssetDownloadSessionNewlyLoadedTimeRangeKey,
_AVAssetDownloadSessionOptimizeAccessForLinearMoviePlaybackKey,
_AVAssetDownloadSessionPreferredAudibleMediaCharacteristicKey,
_AVAssetDownloadSessionPreferredLegibleMediaCharacteristicKey,
_AVAssetDownloadSessionPreferredVisualMediaCharacteristicKey,
_AVAssetDownloadSessionPriorityKey, _AVAssetDownloadSessionProtectedContentSupportStorageURLKey,
_AVAssetDownloadSessionPurchaseBundleKey, _AVAssetDownloadSessioniTunesStoreContentDSIDKey,
_AVAssetDownloadSessioniTunesStoreContentDownloadParametersKey,
_AVAssetDownloadSessioniTunesStoreContentIDKey,
_AVAssetDownloadSessioniTunesStoreContentInfoKey,
_AVAssetDownloadSessioniTunesStoreContentPurchasedMediaKindKey,
_AVAssetDownloadSessioniTunesStoreContentTypeKey,
_AVAssetDownloadSessioniTunesStoreContentUserAgentKey,
_AVAssetDownloadTaskMediaSelectionKey, _AVAssetDownloadTaskMinimumRequiredMediaBitrateKey,
_AVAssetDurationDidChangeNotification, _AVAssetExportPreset1280x720,
_AVAssetExportPreset1920x1080, _AVAssetExportPreset3840x2160,
_AVAssetExportPreset3GPRelease6MMS, _AVAssetExportPreset640x480,
_AVAssetExportPreset960x540, _AVAssetExportPresetAppleM4A,
_AVAssetExportPresetAudioOnlyMMS, _AVAssetExportPresetAuxSmall,
【问题讨论】:
-
您能否展示一些行以及您的示例的结果如何?
-
您能否详细说明包含“_words”的部分以及如何区分文件的其他部分?一个好的开始是添加一个包含每种类型部分的示例。