Delete period preceded by only one character
Question
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.
OTHER TIPS
Not sure to understand what you want. But this is slightly more robust than the other proposal:
sed 's/\b\w\.//g'
Both however also delete the ".c"...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow