Sed / Awk:如何迭代地连接线条

时间:2013-10-16 05:07:15

标签: bash sed awk

我有以下JSON。我希望将整个消息作为一行阅读。这里面临的挑战是在我的文件中有数千个以下这样的企业。我想知道如何用awk或sed写一个脚本,

将每组花束视为一个数据块{....},并将数据块内的所有内容写入一行(包括花括号)

{ 
    "technology": "big data", 
    "message" ":"A Tale Of Two Snow Queens
    It was the best of ani­ma­tion, it was the worst of ani­ma­tion. Over the next cou­ple     months, you will be able to choose for your­self which is the true Queen, and which will be the also ran. One is from #Dis­ney, and one is pro­duced in the frozen land of Rus­sia; both    are based on the clas­sic tale The #SnowQueen By #HansChris­t­ianAnder­sen and both, inter­est­ingly enough, have just released new trail­ers in antic­i­pa­tion of their pend­ing releases.
http://blog.bcdb.com/tale-snow-queens-5921/",
    "permalink":"http://www.facebook.com/BigCartoon/posts/10151959903248792","actor_id":118050938791}

1 个答案:

答案 0 :(得分:0)

您可以尝试这样的事情:

gawk  'BEGIN {RS="{"} {gsub("\n"," "); print}'