Substring string in bash

Issue

I got this string:

xavier.blodot
wisoyo.hadi

And I want this output: firstletter+lastname

xblodot
whadi

Regards!!

Solution

You should use this approach:

sed -r 's:(.).*\.(.+):\1\.\2:g' {YOUR_FILE.TXT}

Answered By – Antonio Petricca

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published