File Merger Ordered on Mac Terminal

--

I have json files named like this: 1.json , 2.json … 604.json

Then, I want to merged those files into one file.

So, the solution is just run this command on terminal:

for f in {1..604}.json; do (cat "${f}"; echo) >> mergedfile.json; done

Just try it!

References:

https://stackoverflow.com/questions/8183191/concatenating-files-and-insert-new-line-in-between-files

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response