Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to trim leading and trailing white space in bash

So I have this specific use case where I get data in a comma-separated values (CSV) file. I pick up the company name, address, telephone, email, and some other data from that file. Once data is collected, I create a final pdf using a simple script. Unfortunately, data comes with unwanted Leading and Trailing white spaces in each field. So my final pdf file gets messed up because of those white space. Let us see how to Trim Leading and trailing white space for a string in Bash running on Linux or Unix machines.

Love this? sudo share_on: Twitter - Facebook - LinkedIn - Whatsapp - Reddit

The post How to trim leading and trailing white space in bash appeared first on nixCraft.



This post first appeared on NixCraft — Linux Tips, Hacks, Tutorials, And Ide, please read the originial post: here

Share the post

How to trim leading and trailing white space in bash

×

Subscribe to Nixcraft — Linux Tips, Hacks, Tutorials, And Ide

Get updates delivered right to your inbox!

Thank you for your subscription

×