in reply to Parse a file, replace a particular strings and save new file
The following code solves your problem as specified.
If it does not do what you WANT, you need to improve your specification.
Of course, it would help if you showed us what you TRIED, and explain what you have trouble with.perl -pe '$x++ ? s/\bvalues\b/100 for string_name100(Transition_11)/ : s/\bvalues\b/500 for string_name500(Transition_11)/ ' FileName.lib > NewFileName.lib
Please read How do I post a question effectively?.
When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
|
|---|