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 -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -