Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-23-2017, 01:05 PM   #1
Registered: Jun 2015
Posts: 88

Rep: Reputation: Disabled
increment a value of string each time

A json file has a line in the following format.
"solution-id": 1

And this line is repeated 1000 times in the file. Now I need to modify the line such that file looks like as follows

"solution-id": 1
"solution-id": 2
"solution-id": 3
""solution-id": 1000"

How can i achieve this using bash?
Old 11-23-2017, 01:22 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,465

Rep: Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828
Do you know how to make a loop?


bash, linux, scripting, unix

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Awk, increment string numbers hurd Linux - Newbie 2 05-28-2016 05:55 PM
Bash shell script: Str(007) to int(7),increment it(8) & convert back to string(008) drwatson_droid Programming 5 12-01-2011 11:44 AM
find time in string kmack1023 Programming 5 12-15-2009 12:02 AM
[Bash] increment number in a string czezz Programming 4 07-01-2009 12:34 PM
Get time as a string HarryBoy Programming 3 08-01-2008 02:34 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration