I have below text in file txt file as in below format
["Dell Inc.", "192.168.101.134", "44:a8:42:27:c7:ba", "PowerEdge R630", "6P84N62", "8", "Intel(R) Xeon(R) CPU E5-2623 v3 @ 3.00GHz", "32059.66", "172.16.100.21"]
but i need this as below format how do i format in linux
Dell Inc. 192.168.101.134 44:a8:42:27:c7:ba PowerEdge R630 6P84N62 8 Intel(R) Xeon(R) CPU E5-2623 v3 @ 3.00GHz 32059.66 172.16.100.21
Advertisement
Answer
echo "your string" |tr [ ' '|tr ] ' '|tr , \n|awk '{$1=$1};1'
Explanation
echo "your string"prints your string, then piped to the nexttrtr [ ' 'substitutes [ with an empty spacetr ] ' 'substitutes ] with an empty spacetr , \nsubstitutes the comma with a newlineawk '{$1=$1};1'(taken from here) trims spaces