LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-23-2017, 12:05 PM   #1
hruday
Member
 
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, 12:22 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

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


Reply

Tags
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 04: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 10:44 AM
find time in string kmack1023 Programming 5 12-14-2009 11:02 PM
[Bash] increment number in a string czezz Programming 4 07-01-2009 11:34 AM
Get time as a string HarryBoy Programming 3 08-01-2008 01:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:19 PM.

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