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 > 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
Search for a pattern in a file and print previous lines from a particular point umaislearning Shell Programming and Scripting 2 03-28-2009 10:20 AM
Pattern matching in Duplicated file and print once Danish Shakil Shell Programming and Scripting 1 08-01-2008 03:55 AM
Sed to delete exactly match pattern and print them in other file new_buddy Shell Programming and Scripting 3 07-10-2008 02:59 AM
searching pattern in another file and print cdfd123 Shell Programming and Scripting 2 10-26-2007 02:30 AM
pattern matching and print with sed nymus7 Shell Programming and Scripting 2 04-14-2005 09:36 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 06-20-2009
vanand420 vanand420 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 60
Print a pattern from a file

Hi ,
Pls help me in solving a problem. I have a file containing several lines as shown below:
Code:
BS30_CFNRC='P';BS30_BAOC='P';BS30_BOIC='P';BS30_BAIC='P';
BS30_BICRO='P';BS30_CAW='P';Loc_Code='VLR known';VLR_address='919457499995';Nbr_indicator='MSC';MSC_MSRN_Nbr='919457499995';
There is no fixed location for the parameter on a line so that i may cut it. I want to fetch on e.g. VLR_address and corresponding value (next few characters (='919457499995') of it so that i may uniquely sort them later for post-processing.

Thnx in advance.

Last edited by Yogesh Sawant; 06-20-2009 at 12:18 PM.. Reason: added code tags
  #2 (permalink)  
Old 06-20-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Something like this?

Code:
sed 's/.*\(VLR_address=[^;]*\);.*/\1/' file
  #3 (permalink)  
Old 06-20-2009
vanand420 vanand420 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 60
Quote:
Originally Posted by Franklin52 View Post
Something like this?

Code:
sed 's/.*\(VLR_address=[^;]*\);.*/\1/' file
Perfect !!!!!!!

Thnx Very much !!!!!!
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 06:00 PM.


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