Re: Need a good Unix script that..
On Wed, Mar 14, 2007 at 05:56:26AM -0400, [EMAIL PROTECTED] wrote: > Hello, > > I'm trying to write a script to delete all line that include a certain > pattern in an output file. I sending information to one of our Security > people and they take this data and create a spreadsheet on the > information, I have a constant reoccurring lines within the output file > that they do not need. I'm trying to use the sed command to remove lines > that fits a certain pattern but it does not appear to remove anything. It can probably be done with sed, but without knowing the specifics of what you're doing, no one can give a meaningful opinion. I use sed, grep, and awk all the time, but I can't tell you anything without seeing your sed statement and a sample file. I'd recommend posting to a forum where sed is a frequent topic and giving enough information to allow someone to actually help you. Someone somewhere maintains a sed FAQ along with a file of 100 sed statements giving examples of various tasks. I can't remember the URL, but googling will probably bring it up. Bob Hall ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Need a good Unix script that..
[EMAIL PROTECTED] wrote: Hello, I'm trying to write a script to delete all line that include a certain pattern in an output file. I sending information to one of our Security people and they take this data and create a spreadsheet on the information, I have a constant reoccurring lines within the output file that they do not need. I'm trying to use the sed command to remove lines that fits a certain pattern but it does not appear to remove anything. Any helpful ideas or any useful links to scripts. Thanks so much.. Bruce Stitt TSYS Hosting Services Voice 706-644-0965 grep -v man grep ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Need a good Unix script that..
On Mar 14, 2007, at 2:56 AM, [EMAIL PROTECTED] wrote: Hello, I'm trying to write a script to delete all line that include a certain pattern in an output file. I sending information to one of our Security people and they take this data and create a spreadsheet on the information, I have a constant reoccurring lines within the output file that they do not need. I'm trying to use the sed command to remove lines that fits a certain pattern but it does not appear to remove anything. Any helpful ideas or any useful links to scripts. Thanks so much.. Bruce Stitt TSYS Hosting Services Voice 706-644-0965 As mentioned, when doing simple regex replacements in Unix, some good languages / programs to use are: grep <- extraction only sed <- simple extraction / replacement perl <- the kitchen sink -Garrett ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Need a good Unix script that..
On Wed, 14 Mar 2007, Christian Walther wrote: On 14/03/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I'm trying to write a script to delete all line that include a certain pattern in an output file. I sending information to one of our Security people and they take this data and create a spreadsheet on the information, I have a constant reoccurring lines within the output file that they do not need. I'm trying to use the sed command to remove lines that fits a certain pattern but it does not appear to remove anything. Any helpful ideas or any useful links to scripts. You can use something like: cat yourfile | grep -v pattern >newfile If there are several patterns to be removed, use something like: cat yourfile | egrep -v "(pattern1|pattern2|pattern3|...)" >newfile The unofficial UNIX guru law says: Using cat with one and only one argument is prohibited! Just a joke, but typing grep -v pattern newfile saves system resources, doesn't it? Best regards Konrad Heuer GWDG, Am Fassberg, 37077 Goettingen, Germany, [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Need a good Unix script that..
Hello Bruce, Without knowing more, may I suggest that you take a look at awk for doing this? You can combine awk and sed if you like. There's a good starting point at http://www.linuxfocus.org/English/September1999/article103.html Good luck! [EMAIL PROTECTED] skrev: Hello, I'm trying to write a script to delete all line that include a certain pattern in an output file. I sending information to one of our Security people and they take this data and create a spreadsheet on the information, I have a constant reoccurring lines within the output file that they do not need. I'm trying to use the sed command to remove lines that fits a certain pattern but it does not appear to remove anything. Any helpful ideas or any useful links to scripts. Thanks so much.. Bruce Stitt TSYS Hosting Services Voice 706-644-0965 - The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. The information may also constitute a legally privileged confidential communication. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Need a good Unix script that..
Why not use Perl? It'd be as simple as: #!/usr/bin/perl use strict; open(IN, "$ARGV[0]") || die "Can't open $ARGV[0]: $!\n"; while () { print $_ unless ($_ =~ /don't want>/); } close IN; Save this script as "filter.pl" (or whatever you want to call it), and then just run "perl filter.pl > ", which will pipe out all the lines you do want to . Alex Kirk Hello, I'm trying to write a script to delete all line that include a certain pattern in an output file. I sending information to one of our Security people and they take this data and create a spreadsheet on the information, I have a constant reoccurring lines within the output file that they do not need. I'm trying to use the sed command to remove lines that fits a certain pattern but it does not appear to remove anything. Any helpful ideas or any useful links to scripts. Thanks so much.. Bruce Stitt TSYS Hosting Services Voice 706-644-0965 - The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. The information may also constitute a legally privileged confidential communication. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Need a good Unix script that..
On 14/03/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hello, I'm trying to write a script to delete all line that include a certain pattern in an output file. I sending information to one of our Security people and they take this data and create a spreadsheet on the information, I have a constant reoccurring lines within the output file that they do not need. I'm trying to use the sed command to remove lines that fits a certain pattern but it does not appear to remove anything. Any helpful ideas or any useful links to scripts. You can use something like: cat yourfile | grep -v pattern >newfile If there are several patterns to be removed, use something like: cat yourfile | egrep -v "(pattern1|pattern2|pattern3|...)" >newfile HTH Christian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Need a good Unix script that..
Hello, I'm trying to write a script to delete all line that include a certain pattern in an output file. I sending information to one of our Security people and they take this data and create a spreadsheet on the information, I have a constant reoccurring lines within the output file that they do not need. I'm trying to use the sed command to remove lines that fits a certain pattern but it does not appear to remove anything. Any helpful ideas or any useful links to scripts. Thanks so much.. Bruce Stitt TSYS Hosting Services Voice 706-644-0965 - The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. The information may also constitute a legally privileged confidential communication. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Need a good Unix script that..
Michael Sharp wrote: I need a simple sh script that will daily (via cron) crawl a website looking for multiple keywords, then reporting those keyword results and URL to an email address. Anyone know of a pre-written script that does this, or point me in the right direction in using the FreeBSD core commands that can accomplish this? If you feed the webserver's access log into various programs like analog, these will report on the keywords people used to search for when linking into the site. (This is not quite what you asked for, but I mention it because the suggestion might be closer to what you want to see... :-) Anyway, if you do not own the site & have access to the logfiles, you ought to honor things like /robots.txt and the site's policies with regard to copyright and datamining, but you could easily use lynx, curl, or anything similiar which supports a recursive/web-spider download capability, and then grep for keywords, do histograms, whatever on the content you DL. -- -Chuck ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Need a good Unix script that..
I need a simple sh script that will daily (via cron) crawl a website looking for multiple keywords, then reporting those keyword results and URL to an email address. Anyone know of a pre-written script that does this, or point me in the right direction in using the FreeBSD core commands that can accomplish this? Michael ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"