Reputation: 375
I have a text file like the one shown below:
A B
A D
S F
D TGT
DS K
FDGFDA S
A RE
I want to replace all strings with more than one character (so "TGT", "DS", "FDGFDA" and "RE" above) with a single character (e.g. "X").
Is there a way to do this? It seems like something sed should do easily, but I can't work out the regex string to use to do it!
Upvotes: 2
Views: 79
Reputation: 375
Thanks to both who answered my question: I found a way with another regex:
sed -i 's/[A-Z][A-Z][A-Z]*/X/g'
Upvotes: 1