Awk how to print without adding spaces between fields

In this article let’s discuss about Awk how to print without adding spaces between fields. Let’s go through the following methods without any delay.

Method 1:

# Short answer:
# If you're getting unwanted spaces between the items you're printing 
# with awk you probably need to remove commas between the items.

# Example of problem:
awk '{print $1, "some-text", $2}' file_to_parse # $1 and $2 are the 
# first and second fields/columns of the the file_to_parse
--> field_1 some text field_2 # Output

# If you didn't want spaces, remove the commas:
awk '{print $1 "some-text" $2}' file_to_parse
--> field_1some-textfield_2 # Output

Hope the above solution works.

Realted Posts : How to install the latest docker on ubuntu 20.04