this should be easy question for most of you but for me.
I need to perform some text operations above json a yml config files, which contains definitions of some channels - structure of every line is the same, except variables.
What would help mi the most is to figure out what is the best way to
1)use file with specific number on each line, to specify line in the big config file 2)after that, tak this line and a) delete it from original (that i know :) b) take this line, find another string in it a change it - always the same change like foo -> bar. and change it in the original file - keep the position of the line with the change.
My problem is part 2b...not sure about that, also i hear sed had problems with yml or json, till now i was using vim to change strings and such, but now its more specific - find line, then change specific string.
If you can give me nay tips, or what can i read/watch to understand properly tools i need so iam able to figure it out my self, ill be grateful
- {channel_id: 483, stream_profile_code: profile1, source_id: igst0-iva, source_domain: }
- {channel_id: 483, stream_profile_code: profile2, source_id: igst0-iva, source_domain: }
- {channel_id: 483, stream_profile_code: profile3, source_id: igst0-iva, source_domain: }
- {channel_id: 483, stream_profile_code: profile4, source_id: igst0-iva, source_domain: }
- {channel_id: 483, stream_profile_code: profile5, source_id: igst0-iva, source_domain: }
- {channel_id: 499, stream_profile_code: profile1, source_id: igst0-iva, source_domain: }
- {channel_id: 499, stream_profile_code: profile2, source_id: igst0-iva, source_domain: }
- {channel_id: 499, stream_profile_code: profile3, source_id: igst0-iva, source_domain: }
- {channel_id: 499, stream_profile_code: profile4, source_id: igst0-iva, source_domain: }
- {channel_id: 499, stream_profile_code: profile5, source_id: igst0-iva, source_domain: }
- {channel_id: 501, stream_profile_code: profile1, source_id: igst0-iva, source_domain: }
- {channel_id: 501, stream_profile_code: profile2, source_id: igst0-iva, source_domain: }
- {channel_id: 501, stream_profile_code: profile3, source_id: igst0-iva, source_domain: }
- {channel_id: 501, stream_profile_code: profile4, source_id: igst0-iva, source_domain: }
- {channel_id: 501, stream_profile_code: profile5, source_id: igst0-iva, source_domain: }
Here i need to find only every line containing channel_id 499 and change igst0-iva to igst1-ven. The liste of channel ids i need to find is in external file i already prepared. This is small example, its around 30 ids i have to change from total 200.