V 
VPS Hosting Referral Code PCGPDB


MAN PAGES INDEX
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 31, 2010, 09:04:22 AM

Login with username, password and session length
« previous next »
Pages: [1] Print
Author Topic: grep, egrep, fgrep  (Read 1223 times)
bashconsole
Administrator
Newbie
*****
Posts: 30


View Profile Email
« on: May 10, 2009, 02:59:42 PM »

NAME
       grep, egrep, fgrep - print lines matching a pattern

SYNOPSIS
       grep [options] PATTERN [FILE...]
       grep [options] [-e PATTERN | -f FILE] [FILE...]

DESCRIPTION
       Grep  searches  the  named  input  FILEs (or standard input if no files are named, or the file name - is
       given) for lines containing a match to the given PATTERN.  By default, grep prints the matching lines.

       In addition, two variant programs egrep and fgrep are available.  Egrep is the same as  grep -E.   Fgrep
       is the same as grep -F.

http://bashconsole.org/man.1.grep
Logged
bashconsole
Administrator
Newbie
*****
Posts: 30


View Profile Email
« Reply #1 on: May 10, 2009, 03:05:56 PM »

Excludes new emails according to exclude-list. Input file format: one email per line. Output: new unique emails are in *.csv file.
Code:
#!/bin/bash

echo "Joining..."
cat EXCLUDE-LIST $1 > 1
echo "Sorting..."
cat 1 |sort|uniq > 2
echo "Excluding new records..."
diff EXCLUDE-LIST 2 > 3
cat 3 |egrep -e '\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.\w{2,6}' > 4
replace "> " "" -- 4
echo "Preparing results..."
mv 2 EXCLUDE-LIST
mv 4 $1.cvs
rm 1 3
Logged
Pages: [1] Print
« previous next »
Jump to:  

Page created in 0.054 seconds with 21 queries. (Pretty URLs adds 0.011s, 2q)