If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > script for extracting some lines from a text file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-08-11, 11:26
prakashr85 prakashr85 is offline
Registered User
 
Join Date: Jun 2011
Posts: 1
script for extracting some lines from a text file

I have a text file which has thousands of lines I need to extract some lines based on some key words present in the line. Like this

120611 aaaaabbbbbccccccc
120611 cccccdddddeeeeeee
120711 ddddeeeefffffffffffff

now I need to extract those lines which contains the keyword 'de' and save it to a new file
Reply With Quote
  #2 (permalink)  
Old 06-08-11, 12:33
Pat Phelan Pat Phelan is online now
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,612
Code:
gawk "/de/" de
Works for a file named de.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #3 (permalink)  
Old 06-08-11, 14:45
n_i n_i is online now
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,453
Whatever happened to good old grep?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On