Replace some spaces and ; with a single ; [closed]

With a bash script I need to substitute, in a file, some spaces followed by ; with a single ;, or ; followed by some spaces with a single ;

I have a file like this

davide de marchi;        hello;   world     ; again;
simon ;   said;   goodbye boys ;

I need to have this result

davide de marchi;hello;world;again;
simon;said;goodbye boys;

I tried a lot of different sed but it doesn’t work

thankyou

  • 3

    Show us what you have searched/tried

    – 

  • 1

    "s/ *; */;/g" would work.

    – 




  • It work!!!!!! Thankyou very much!!!!!

    – 

Leave a Comment