The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to strip non numerical data out of file? Juha Shell Programming and Scripting 10 01-09-2007 04:09 AM
Creating file contents using contents of another file ReV Shell Programming and Scripting 21 02-24-2006 07:25 AM
How to strip the contants from a file isingh786 UNIX for Dummies Questions & Answers 2 12-16-2005 04:11 PM
How to strip apostrophe from a file aquimby Shell Programming and Scripting 8 06-23-2005 12:04 PM
trying to strip the first 4 char. of a file out via commandline Optimus_P UNIX for Dummies Questions & Answers 2 06-12-2001 10:02 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #8  
Old 11-22-2005
Registered User
 

Join Date: Nov 2005
Posts: 6
sed -e 's/^isa//g' -e 's/[89][469][279]$//g' td.txt

this takes out the isa from beginning and then the numbers (three numbers) from the end of the line.you may output this code to a new file once you satisfied with the result.
Reply With Quote
Forum Sponsor
  #9  
Old 11-22-2005
Registered User
 

Join Date: Aug 2005
Posts: 75
Hi Rkl1,

Thanks for the reply!!!

This command just shows all the contents of the file. There are multiple ISA in the file, so it is showing all of them. But, I just want to see the contents for 999 not for 862 or others.

In other words, what I need is look for the occurences of the 997 in the file. Once I find any 997, look for ISA before the 997 and then look for ISA after the 997 and extract that pice of data. i.e. extract the data between two ISA's which has 997 and there can be multiple occurences of 997 in a file.

Regards,
Inder
Reply With Quote
  #10  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,003
using gawk:
Code:
gawk -v RS='ISA' '/997/ {print RS $0}' myFile.txt
Reply With Quote
  #11  
Old 11-22-2005
Registered User
 

Join Date: Aug 2005
Posts: 75
Thanks a lot sir!!

It works perfect. Let me do some more testing with adding some other data to the file and I will let you know the results. Thanks!!!

Inder
Reply With Quote
  #12  
Old 11-28-2005
Registered User
 

Join Date: Aug 2005
Posts: 75
Hi Vgersh99,

Sorry for the delayed response.

It works perfectly. Thanks for all your help.

Regards,
Inder
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0