INPUTRANDOMSTRING BLA-BLA [111] RANDOMSTRING BLA-BLAOUTPUTRANDOMSTRING BLA-BLA [200] RANDOMSTRING BLA-BLA[111] could contain various numbers with 3 digits: 120 or 300 or 400 or 101, etc.So all I want ~this: sed s/Howtos<\/a> \[111] \//`grep '^<a href=' list.txt | wc -l`/ original.txtRegexp'ing the 111 that's the only thing I can't figure outThe output of:grep '^<a href=' list.txt | wc -lwould be e.g.: 200 in the example
sed regexp for: [111]
sed
regex for 3 digit number:  [0-9]{3} So to replace 111 with 200:sed -E 's/[0-9]{3}/200/g'you need the -E flag for extended regexs