Sponsored Content
Top Forums Shell Programming and Scripting awk - print file contents except regex Post 302222826 by shamrock on Thursday 7th of August 2008 02:44:37 PM
Old 08-07-2008
Code:
awk '/^Email/ && /@/' file

gives you only the lines that have the @ symbol embedded in them.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using first word and print their contents using awk

suppose u hava a file G1354R tGGC-CGC D1361N cGAC-AAC I1424T ATC-ACC R768W gCGG-TGG Q1382R CAG-CGG Q178E gCAG-GAG Y181C TAC-TGC .........cont. So the question is By searching for first word i.e.character say R output shud be R768W gCGG-TGG R182P CGG-CCG R189W ... (6 Replies)
Discussion started by: cdfd123
6 Replies

2. UNIX for Advanced & Expert Users

print contents of file2 for matching pattern in file1 - AWK

File1 row is same as column 2 in file 2. Also file 2 will either start with A, B or C. And 3rd column in file 2 is always F2. When column 2 of file 2 matches file1 column, print all those rows into a separate file. Here is an example. file 1: 100 103 104 108 file 2: ... (6 Replies)
Discussion started by: i.scientist
6 Replies

3. Shell Programming and Scripting

Read contents of the file and print

AT ---------- 0 Elapsed: 00:00:00.02 SO ---------- 0 Elapsed: 00:00:00.01 SE ---------- 0 Elapsed: 00:00:00.01 CR ---------- (4 Replies)
Discussion started by: sandy1028
4 Replies

4. Shell Programming and Scripting

need to grep contents of a file within specific time span. regex i am using is not working

Hi , I am trying to extract contents of a file between specified time stamp. but it does not seem to work. i am trying to extract output of /var/adm/messages between 15:00:00 to 15:23:59 . i have tried two regex the first one seems to kind of work. it displays some output. the second one is... (13 Replies)
Discussion started by: chidori
13 Replies

5. Shell Programming and Scripting

awk: compose regex in variable and then use its contents like $0 ~ var

A question to the awk pundits: I was thinking about composing a regex in a variable and then use its contents like $0 ~ var instead of $0 ~ /r/. Sort of indirection. Did someone run into this? Is it possible at all? (3 Replies)
Discussion started by: RudiC
3 Replies

6. UNIX for Dummies Questions & Answers

read regex from ID file, print regex and line below from source file

I have a file of protein sequences with headers (my source file). Based on a list of IDs (which are included in some of the headers), I'd like to print out only the specified sequences, with only the ID as header. In other words, I'd like to search source.txt for the terms in IDs.txt, and print... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

7. Shell Programming and Scripting

To print lines between 2 timestamps using awk|sed and regex

Hi, I am using the following code to fetch lines that are generated in last 1 hr . Hence, I am using date function to calculate -last 1 hr & the current hr and then somehow use awk (or sed-if someone could guide me better) with some regex pattern. dt_1=`date +%h" "%d", "%Y\ %l -d "1 hour... (10 Replies)
Discussion started by: sarah-alikhan31
10 Replies

8. Shell Programming and Scripting

For loop inside awk to read and print contents of files

Hello, I have a set of files Xfile0001 - Xfile0021, and the content of this files (one at a time) needs to be printed between some line (lines start with word "Generated") that I am extracting from another file called file7.txt and all the output goes into output.txt. First I tried creating a for... (5 Replies)
Discussion started by: jaldo0805
5 Replies

9. UNIX for Advanced & Expert Users

awk print all fields except matching regex

grep -v will exclude matching lines, but I want something that will print all lines but exclude a matching field. The pattern that I want excluded is '/mnt/svn' If there is a better solution than awk I am happy to hear about it, but I would like to see this done in awk as well. I know I can... (11 Replies)
Discussion started by: glev2005
11 Replies

10. Shell Programming and Scripting

(n)awk: print regex search output lines in one line

Hello. I have been looking high and low for the solution for this. I seems there should be a simple answer, but alas. I have a big xml file, and I need to extract certain information from specific items. The information I need can be found between a specific set of tags. let's call them... (2 Replies)
Discussion started by: Tobias-Reiper
2 Replies
Email::FolderType(3pm)					User Contributed Perl Documentation				    Email::FolderType(3pm)

NAME
Email::FolderType - determine the type of a mail folder SYNOPSIS
use Email::FolderType qw(folder_type); print folder_type "~/mymbox"; # prints 'Mbox' print folder_type "~/a_maildir/"; # prints 'Maildir' print folder_type "some_mh/."; # prints 'MH' print folder_type "an_archive//"; # prints 'Ezmlm' DESCRIPTION
Provides a utility subroutine for detecting the type of a given mail folder. SUBROUTINES
folder_type <path> Automatically detects what type of mail folder the path refers to and returns the name of that type. It primarily bases the type on the suffix of the path given. Suffix | Type --------+--------- / | Maildir /. | MH // | Ezmlm In case of no known suffix it checks for a known file structure. If that doesn't work out it defaults to "Mbox" although, if the "Mbox" matcher has been overridden or the default changed (see DEFAULT MATCHER below) then it will return undef. matchers Returns a list of all the matchers available to the system. DEFAULT MATCHER
Currently the default matcher is "Mbox" and therefore it is always checked last and always returns 1. If you really want to change this then you should override "Email::FolderType::Mbox::match" and/or change the variable $Email::Folder- Type::DEFAULT to be something other than 'Mbox'. use Email::FolderType; use Email::FolderType::Mbox; $Email::FolderType::DEFAULT = 'NewDefault'; package Email::FolderType::Mbox; sub match { return (defined $_[0] && -f $_[0]) } package Email::FolderType::NewDefault; sub match { return (defined $_[0] && $_[0] =~ m!some crazy pattern!) } 1; REGISTERING NEW TYPES
"Email::FolderType" briefly flirted with a rather clunky "register_type" method for registering new matchers but, in retrospect that wasn't a great idea. Instead, in this version we've reverted to a "Module::Pluggable" based system - any classes in the "Email::FolderType::" namespace will be interrogated to see if they have a c<match> method. If they do then it will be passed the folder name. If the folder matches then the match function should return 1. For example ... package Email::FolderType::GzippedMbox; sub match { my $folder = shift; return (-f $folder && $folder =~ /.gz$/); } 1; These can even be defined inline ... #!perl -w use strict; use Email::Folder; use Email::LocalDelivery; # copy all mail from an IMAP folder my $folder = Email::Folder->new('imap://example.com'); # read INBOX for ($folder->messages) { Email::LocalDelivery->deliver($_->as_string, 'local_mbox'); } package Email::FolderType::IMAP; sub match { my $folder = shift; return $folder =~ m!^imap://!; } 1; If there is demand for a compatability shim for the old "register_type" method then we can implement one. Really though, this is much bet- ter in the long run. PERL EMAIL PROJECT
This module is maintained by the Perl Email Project. http://emailproject.perl.org/wiki/Email::FolderType AUTHOR
Simon Wistow <simon@thegestalt.org> COPYING
(C) Copyright 2005, Simon Wistow Distributed under the same terms as Perl itself. This software is under no warranty and will probably ruin your life, kill your friends, burn your house and bring about the apocalypse. SEE ALSO
Email::LocalDelivery, Email::Folder perl v5.8.8 2006-08-22 Email::FolderType(3pm)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy