I have several lines with this kind of text in a text file:
plink2.V1204_V
plink2.V1405_F
plink2.V12_V
xyz.V18_Z
plink2.V3049_G
plink2.V674_T
plink1.V901_V
hatzj.V7_X
Now I would like to delete everything before the .V
(this is always a V). But sometimes there is also a _V
. This I would like to leave it as it is.
I tried:
sed -i 's/^.*V/V/' file.txt
But then it deletes everything before the _V
CodePudding user response:
Include the literal dot \.
:
sed 's/^.*\.V/.V/'