
April 13th, 2011, 12:50 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 1
Time spent in forums: 49 m 52 sec
Reputation Power: 0
|
|
|
Sed Script
Quote: | Originally Posted by sangfroid Hi,
why this small sed script is printing abcdef55swerer55er ? Isn't it supposed to print only abcdef ??
PHP Code:
-bash-4.1$
echo abcdef55swerer55er|sed 's/\([a-zA-Z]*\) \([a-zA-Z]*\) /\1 /'
abcdef55swerer55er
|
If I'm reading this correctly, you are asking sed to match any number of characters from the group a-zA-Z followed by the same and then with the back reference replace them with the same letters. Any other characters will just pass thru unchanged.
|