I have a text file like this
abcdefg abcdefg abcdefg abcdefg
How to remove the first and last two characters from each line using sed? I would like to get the result as follows
bcde bcde bcde bcde
sed 's/^.\(.*\)..$/\1/' file
This might work for you:
sed 's/^.\|..$//g' file