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
Read a file and search a value in another file create third file using AWK King Kalyan Shell Programming and Scripting 11 06-19-2009 12:05 AM
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 11-12-2008 09:12 PM
how can search a String in one text file and replace the whole line in another file kkraja UNIX for Dummies Questions & Answers 6 08-06-2008 07:23 AM
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 10:17 PM
How to search a pattern inside a zipped file ie (.gz file) with out unzipping it senraj01 Shell Programming and Scripting 2 04-26-2006 04:32 AM

Reply
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 07-21-2009
mjkreddy's Avatar
mjkreddy mjkreddy is offline
Registered User
  
 

Join Date: Jun 2009
Location: INDIA
Posts: 6
Search from a file.

Hi,

I have a huge file with 3feilds,and in the 3rd feild there is 038 number which is repetative, now i have to grep only 038 record WHOLE RECORD for that particluar number. and this 038 is also present in 2nd feild as well, but i want to perform grep only on 3rd feild and redirect into new file.

my data is like this
Code:
T000038999 013  038
T000038999 013  054
T000038999 038  077
T000038999 013  098
T000038999 013  038
T000038999 013  041
T000038999 038  043
T000038999 013  038
i have used following code
Code:
grep "^[0-9a-zA-Z]*38" <my file >> test1.txt
but doesn't work for me.

can any one please help me out.

Last edited by Yogesh Sawant; 07-21-2009 at 03:09 AM.. Reason: added code tags
  #2 (permalink)  
Old 07-21-2009
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
how about:
Code:
grep '038$' datafile > test1.txt
  #3 (permalink)  
Old 07-21-2009
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,088
Code:
egrep '.* .* 038'
  #4 (permalink)  
Old 07-21-2009
mjkreddy's Avatar
mjkreddy mjkreddy is offline
Registered User
  
 

Join Date: Jun 2009
Location: INDIA
Posts: 6
Yogesh idnt got any thing file was empty.

there are 038 records in 3rd feild as well as 2nd feild but i want to perform search and grep the 3feild records with full row corespoding to 038.
Reply

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 09:52 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