perl - Trim trailing and leading spaces in a file fields separated by delimiter using unix command -



perl - Trim trailing and leading spaces in a file fields separated by delimiter using unix command -

input file:

abc | hello |123 | def | hi ram | 456 |

output file should follows

abc|hello|123| def|hi ram|456

please allow me know if can accomplish using awk or sed commands. want execute same in perl using scheme command

perl -lpe 's/ \s*[|]\s* /|/xg' file

output

abc|hello|123| def|hi ram|456|

perl unix awk sed

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -