简体   繁体   中英

How to seperate repeat pattern in a line using sed or awk, and save them to lines?

I am having a lot of files consisting a very long line (size unknown), in a pattern

[ ["11/24/19","5.34","2.38",..."9.35"], 
["11/23/19","4.36","9.29",..."8.35"], [...], [...], [...] ]

I want to separate the line into pieces, looks like the following:

"11/24/19","5.34","2.38",..."9.35"
"11/23/19","4.36","9.29",..."8.35"
...

A beginner for sed or awk , trying for several hours with no luck. Any suggestions? Thanks a lot.

First, replace ], with a newline. Then, remove all the square brackets.

sed 's/],/\n/g;s/[][]//g'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM