Now i have a variable that contains " nas1:/abc/test/test1 " value , so i need to search the above file for this variable and print only this line.
output expected :- nas1:/abc/test/test1 /test
i tried cat abc.txt | grep -w "nas1:/abc/test/test1 " , its not working for few linux servers , so can i have some commands that can run on all distros.
Where variable's value is stored in above code as named VAL and it is looking for first field to match it, in case you need to change the string and change the matching field you could change above VAL=new_string_value and in place of $1 you could use $2 second field or $3 3rd field etc.
What exactly is not working? How do the grep versions differ on the various system? How the input files (<TAB> / space separated?)?
Please note the -w wouldn't succeed, as / is NOT a word constituent character.
Just need one more help , actually when i am running the below code on mutiple servers for the NFS filesystems , it gets hung , so is there any way we can add a timeout kind of thing to exit from the server where NFS is having issues and continue with next set of servers.