March 31st, 2011, 09:33 PM
why this small sed script is printing abcdef55swerer55er ? Isn't it supposed to print only abcdef ??
echo abcdef55swerer55er|sed 's/\([a-zA-Z]*\) \([a-zA-Z]*\) /\1 /'
April 13th, 2011, 01:50 PM
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.
Originally Posted by sangfroid
April 17th, 2011, 03:57 PM
in your sed you use a 'space' as trailor AND you have no 'spaces'
echo abcdef55swerer55er|sed 's/\([a-zA-Z]*\)\([0-9]\).*/\1/'
working on Solaris[5-9], preferred languages french and C.