1
1
By default ack
command prints the output in follwing way
ack --jsp '</div>'
a.jsp
5:</span></div>
10:</table></div>
b.jsp
3:</div><div>xyz
8:</div><a>
is there any way to output the result in following way ?
<filename>:<linenum>:<matchedtext>
a.jsp:5:</div>
a.jsp:10:</div>
b.jsp:3:</div>
b.jsp:8:</div>
Though there is --output=expr
to output match based on regex capture group I am not sure if there is any way to get the name of the file that has matched text along with the line number
ack --jsp -o -h --output=':$1:$2' '(</(div)>)'
:</div>:div
:</div>:div
:</div>:div
:</div>:div
if not possible with ack, is there any alternate way to do it ?