LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-03-2014, 09:01 AM   #1
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Rep: Reputation: 5
Extract every record except


I know how to extract every record that contains a pattern:

grep "404" <f1> > <f2>

But is there a way to extract every record that doesn't contain the pattern?

Thanks.
 
Old 12-03-2014, 09:28 AM   #2
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
Hi,

Read the man page of grep and pay special attention to the -v option.


Cheers,
 
Old 12-03-2014, 09:59 AM   #3
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Original Poster
Rep: Reputation: 5
Thanks. Just to leave an example:

echo "$(grep -v "\*" <f1>)"

This displayed every line in file <f1> that didn't contain an asterisk.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Create MX Record In CentOs so i can use it on my domain txt record? ASTRAPI Linux - Server 3 07-11-2014 11:01 AM
[SOLVED] DNS: A Record and PTR Record hydraMax Linux - Server 4 12-21-2010 11:28 PM
how to make resolver ask for A record before AAAA record Skaperen Linux - Networking 25 03-02-2010 07:36 PM
DDNS record and a static PTR record mou5e Linux - Networking 2 01-22-2008 02:16 AM
Unable to record mic-in with SoundBlaster Live! while able to record other sources max76230 Linux - Newbie 2 03-14-2005 05:31 AM


All times are GMT -5. The time now is 10:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration