Reputation: 67
I have a text file like this
abcdefg abcdefg abcdefg abcdefg
How to delete the first and last two characters from each line with sed? I would like to get the output like this
bcde bcde bcde bcde
Upvotes: 3
Views: 1449
Reputation: 58400
This might work for you:
sed 's/^.\|..$//g' file
Upvotes: 0
Reputation: 455020
sed 's/^.\(.*\)..$/\1/' file
Upvotes: 4