i have come across a question which asks to write an awk command that displays all records having 2nd and 3rd characters same.
i could write the solution in sed, using tagged regular expression, as follows :
sed -n '/^.\(.\)\1.*$/' emp.list
However, as far as i know, tagged expression are not applicable in awk. I wrote the solution in awk using substr() :
awk '{ if (substr($0,2,1) == substr($0,3,1)) print $0; }' emp.list
What i want to know is is there any other way in awk to solve this question? I just want to use a regular expression as i did in sed.
Also, is there any other way to write this in sed as well?
Thank you :)