Firenze, dà fuoco al drappo nero sul David per la guerra in Ucraina: arrestato
12 Marzo 2022
Firenze, la manifestazione “Cities stand with Ukraine”. In collegamento il presidente Zelensky
12 Marzo 2022
Firenze, dà fuoco al drappo nero sul David per la guerra in Ucraina: arrestato
12 Marzo 2022
Firenze, la manifestazione “Cities stand with Ukraine”. In collegamento il presidente Zelensky
12 Marzo 2022

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: TwitterFacebookLinkedInWhatsappReddit

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