你好在下面的sed命令中,我需要在第二組圓括號中不接受以下一組單詞:Inc The Ltd LLC如何使用sed搜索和替換,而不包含一組字符?
它會打破list.txt中的以下數據公司名稱在一行中,公司名稱在逗號後面,但有時候「Inc」,「Ltd」,「LLC」和「The」跟隨公司。
這是相當先進的正則表達式,我似乎得不到。
sed -re 's/([a-zA-Z.]), (Need code here)/\1\n\2/g' list.txt
LIST.TXT具有以下數據:
Electronic Arts, Inc., Electronic Arts Ltd.
Activision Publishing, Inc., ak tronic Software & Services GmbH
Coplin Software
Electronic Arts, Inc.
Electronic Arts, Inc.
In-Fusio
Activision Publishing, Inc.
Domark Ltd.
Electronic Arts, Inc.
Electronic Arts, Inc.
Aspyr Media, Inc., Electronic Arts, Inc.
Activision Deutschland GmbH, Activision Publishing, Inc., ak tronic Software & Services GmbH, Noviy Disk, Square Enix Co., Ltd.
Electronic Arts, Inc.
Electronic Arts, Inc., Electronic Arts Ltd.
Electronic Arts, Inc.
Electronic Arts, Inc.
Electronic Arts, Inc., Electronic Arts Square, K.K., MGM Interactive
Electronic Arts Ltd.
預期輸出(注意逗號):
GarageGames, Inc.
The Avalon Hill Game Company
Microforum International, The
Telenet Japan Co., Ltd.
Glu Mobile, Inc.
Warner Bros. Digital Distribution
Atari, Inc.
你想不匹配一組字符,或特定的詞? – Barmar
您使用'[^ abcxyz]'匹配不在'xyzabc'中的字符。 – Barmar
你可以發佈和'list.txt'的簡短例子嗎? –