tommym121
asked on
How to extract a string that have a given substring within in a line in a shell script
I have multiple lines like the following line
'/home/user1/myapp -s -t -f /tmp/abc.cfg
I need to extract /tmp/abc.cfg out. It always prefix with this token '-f;'. The extracted string has to have ".cfg".
what kind of unix tool can I use. I have no access to GNU tools
'/home/user1/myapp -s -t -f /tmp/abc.cfg
I need to extract /tmp/abc.cfg out. It always prefix with this token '-f;'. The extracted string has to have ".cfg".
what kind of unix tool can I use. I have no access to GNU tools
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
You're welcome ;)
What exactly is the expected output?
Is the shown input line complete or does/can it contain more text?
Do you really want to search for "/tmp/abc.cfg" or rather for any string that might follow "-f"?