I am trying to extract the value associated with string, but need an optimal way.
name=sandeep login_name=sn003 version=3.0 rel_no=456....
The above text is stored in a file.
I am trying to search for a part of string and then print the entire value.
Say I need to search using login
and output should be
login_name=sn003
I have tried the command
cat filename | awk -F" " '{print $2}'
If login_name
is not the second field this will not print though.
How can i search for a string in any position and then print the result ?
Thanks in advance.