Non greedy text matching and extrapolating in bash
问题 I have a utility that can parse the attributes within a large xml tag, such as <mytag name="value" name="value"../> I have written the utility in perl. It uses basic non-greedy text matching, like this: while(<XML>) { if (/name=\"(.+?)\"/) { print("Value is: $1\n"); } I know the names of the name/value pairs I want to extract, so I hardcode them into the utility. This works for me quite well...how can I do this in bash? I have tried using awk but it is not working for when I have an attribute