文件我有一個文件從格式化用awk
adaptable adapt:stem<>able:suffix
addiction addict:stem<>ion:suffix
adornment adorn:stem<>ment:suffix
advertisement advertise:stem<>ment:suffix
aggravation aggravate:stem<>ion:suffix
aggregation aggregate:stem<>ion:suffix
agreeable agree:stem<>able:suffix
以下我需要將其轉換爲以下形式
(adaptable ((adapt:stem)able:suffix))
(addiction ((addict:stem)ion:suffix))
(adornment ((adorn:stem)ment:suffix))
(advertisement ((advertise:stem)ment:suffix))
(aggravation ((aggravate:stem)ion:suffix)))
(aggregation (aggregate:stem)ion:suffix))
(agreeable ((agree:stem)able:suffix))
where most complex ones are
(imperialistic (((imperialism:stem)ist:suffix)ic:suffix))
我試着用awk來做到這一點。 這是代碼,我使用awk '{print $0")"}' restof120.txt by executing the command it added
)`在所有行的末尾。
awk '{print "("$0")"}'
我的問題是有沒有辦法自動轉換格式?使用任何軟件包。
有複雜的情況下 例子
indecipherable in:prefix<>decipher:stem<>able:suffix
(indecipherable (((in:prefix)decipher:stem)able:suffix))
更新:一些模式,我見過
inactive in:prefix<>active:stem
(inactive ((in:prefix)active:stem))
您的輸入與您的輸出不匹配 - 輸出中有4條額外的行。 –
什麼是_altruistic_的輸入,這是最複雜的情況;還有比這更復雜嗎? –
有帝國主義的帝國主義:幹)ist:後綴ic:後綴 – Karun