Search code examples
awksedperiod

Delete period preceded by only one character


How can I delete a period preceded by only one character?

I'm looking for a one line sed or awk code.

The target line is: (the target pattern I want to delete is in **Bold stackoverflow code ***j.*** **)

xxx-xxx, **j.** c., univ los xxx, res grp porous solid \& calorimetry, dept chem, fac sci, bogota, colombia.  

and the result I'm looking for:

xxx-xxx, c., univ los xxx, res grp porous solid \& calorimetry, dept chem, fac sci, bogota, colombia. 

Solution

  • sed 's/ [a-zA-Z]\./ /g' <filename> will work if you are sure that these characters will not appear at the start of the line and that all such characters will be preceded by spaces.