I have this HTML page (template.html) & I want to extract the value of input form_nonce
<div class="row">
<div class="col s12 input-field">
<input type="hidden" name="form_nonce" id="reset_form_nonce" value="66eef7c75d28e44817959c8eec1e0074"/>
<input type="text" placeholder="" name="form_login" id="reset_form_login" class="input" value="" size="20"
autocorrect="off" autocapitalize="none"
tabindex="10"/>
<label for="reset_form_login"><i class="icon-user icon"></i> Username or Email</label>
</div>
</div>
<div class="row">
<div class="col s12 input-field">
<input type="hidden" name="form_nonce" id="reset_form_nonce" value="66eef7c75d28e44817959c8eec1e0074"/>
<input type="text" placeholder="" name="form_login" id="reset_form_login" class="input" value="" size="20"
autocorrect="off" autocapitalize="none"
tabindex="10"/>
<label for="reset_form_login"><i class="icon-user icon"></i> Username or Email</label>
</div>
</div>
I used the following command:
NONCE=`grep -m 1 "form_nonce" template.html | awk -F '"' '{print $8}'`
But the problem is that I don't always receive the input in this format so sometimes it's 7 , 8 or 9. Is there a way to focus on the value keyword instead of assuming the order of the value?
grep -Po 'name="form_nonce".*value="\K[^"]+'-m 1to continue search for more than one pattern