bash script to filter a text file
This is a follow up to my thread: controlling grep output to file. I am working on the reply to that thread.
I started getting long winded then decided to make this succinct. Given a file of the basic format Quote:
The third one is to be deleted because it is a self reference. When the line ends with the searched for string it is to be deleted. The fourth is to be deleted because it is within a git directory. Anything containing “.git” is to be deleted. When the phrase “Searching for” is found, the filtering begins anew. There is a blank line before each “Searching for” phrase if that matters. The question is: What is the best utility to implement this? Just point me in the right direction and I will see what I can discover. RESOLVED After writing a few test scripts and spending some time with awk I have decided that filtering the text file with awk is the best way to go. Thank you for taking the time to read this question and posting replies. |
grep, sed, and/or awk
|
So far awk seems to be the best fit.
Thanks for the post. |
I suggest you to continue the original thread (opening new threads makes it hard to follow you and you will not get more help [ or attention ] - because some part of the information is not available). From the other hand it would be better to explain your problem better - to be able to give better help.
|
that all depends on where you put your vars to "print out" echo, as everything you need is within that script I wrote incorporating @keefaz stuff , and perhaps more.
it gives you the file it is looking for, the file it finds it in, and you have the file it is looking in to find the match. its all there. https://www.linuxquestions.org/quest...95#post5867095 Code:
$ ./findscripts and swapping the line to this Code:
while IFS=: read -r number file other; do |
All times are GMT -5. The time now is 12:27 PM. |