I need to use sed to replace everything before matching pattern with another string in a file
There are various paths in my file. Last few components of those paths are the same irrespective of the user, however, the first few components will change.
For e.g. For user 1, the file contains the following path
build:
- "/Users/user1/Projects/Stash/sdk/license.txt"
For user 2, the path could be
build:
- "/Users/user2/Documents/Work/sdk/license.txt"
The last 2 components are i.e. "/sdk/license.txt" are the same for every user.
I want to replace everything before these components with the path provided by the user as it is specific to that user. How to use sed to perform this kind of substitution? I am using a Perl script for the same.
build: - "/Users/Neeraj/project/sdk/license.txt"