In a folder and its subfolders, I want to search a pattern. For this I am using: grep+cut+awk+tr
pipeline.
printf "I am so wide alper world zorro the end\t\t\talper\n" > alper.txt
printf "zorro alper alper alper skfjsdlkfj dslfj dslkj dslfkj sldk\n" > doo.tex
mkdir .git && printf "zorro zoo\n" > .git/test_file.tex
grep -Hrn -e "zorro" --exclude-dir='.git' --color=always -I -F . | \
cut -c 11- | awk '$0="\033[33;35m"$0' | tr -s '[:space:]' | ifne less -r
alper.txt:1:I am so wide alper world zorro the end alper
doo.tex:1:zorro alper alper alper skfjsdlkfj dslfj dslkj dslfkj sldk
Here searched pattern (zorro
) shown in bold red color.
Is shown with following order:
<filename>:<line_number>:<matching line>
How can I do this pipeline to find the files and awk to search within the files using find
?