The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
extracting lines from a file trichyselva UNIX for Dummies Questions & Answers 4 09-02-2008 06:18 AM
Extracting lines between 2 strings only if the pattern patches simran Shell Programming and Scripting 5 04-23-2008 04:58 PM
Extracting data from text file based on configuration set in config file suparnbector Shell Programming and Scripting 3 08-10-2007 02:25 AM
Extracting the lines between 2 strings of a file babloo Shell Programming and Scripting 2 02-14-2007 11:27 AM
Help required regarding Extracting lines from a file google_ever Shell Programming and Scripting 1 10-12-2005 07:02 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-15-2005
pradeepthanraj pradeepthanraj is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 3
extracting lines from a file

Hi all,

I need to extract some lines from a file based on a condition. For ex:
My file will contain 50 lines and i need to extract line which has "File" in it and then the line which has "date" in it. Which command will be the most efficient way to do it. I have tried two ways
1. reading the file line by line and seperating the line if the line has the filed "File"
2. grep the file for the field "File" .
Since i need to open around 1000 files and perform the operation , can anyone provide me the most optimal way to do it .
  #2 (permalink)  
Old 11-15-2005
ashterix ashterix is offline
Registered User
  
 

Join Date: Nov 2005
Location: cyberjaya
Posts: 85
you can use egrep

$ egrep File | egrep date filenames
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0