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

ruby on rails - Devise Logout Error in RoR -

model view controller - MVC Rails Planning -

php - Working with pretty urls on apache and fastcgi after hhvm installation -