Artificial intelligent assistant

awk or sed or perl: remove only characters on specific position I have multiple files to rename leng-1494-001 leng-1464-002 leng-2414-004 leng-7894-005 leng-1323-006 I want to rename it ferr-1494-001 ferr-1464-002 ferr-2414-004 ferr-7894-005 ferr-1323-006 I know how to do for ferr and leng,but how to replace characters from 6 to 10( 1464,7894) with blank line for example,or string like aaaa bbbb cccc using sed? Also awk or perl solution is welcome. Thanks

POSIXly:


$ sed -e 's/-[^-]*-/-/' file
leng-001
leng-002
leng-004
leng-005
leng-006

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 30069104793522ee887b32bbfa2d2600