Print all Fields with AWK separated by OFS

前端 未结 2 632
后悔当初
后悔当初 2020-12-14 01:20

Is there a way to print all records separated by the OFS without typing out each column number.

#Desired style of syntax, undesired result
[kbrandt@glade: ~         


        
2条回答
  •  旧巷少年郎
    2020-12-14 01:42

    Sed equivalent:

    $ echo "1 2 3 4" | sed 's/ /:-)/g'
    

    Here's another option with awk:

    $ echo "1 2 3 4" | awk '{ gsub(/\s/, ":-)")}1' 
    

提交回复
热议问题