Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

awk how to print without adding spaces between fields

# 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:
# $1 and $2 are the first and second fields/columns of the the file_to_parse
awk '{print $1, "some-text", $2}' file_to_parse
--> field_1 some-text field_2

# If you didn't want spaces, remove the commas:
awk '{print $1 "some-text" $2}' file_to_parse
--> field_1some-textfield_2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #awk #print #adding #spaces #fields
ADD COMMENT
Topic
Name
5+5 =