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 !!

Closed Thread
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 Rate Thread Display Modes
  #1 (permalink)  
Old 10-18-2006
habuzahra habuzahra is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 29
I need Help

09:30:04,438 INFO : FIXEngine[engine1]: INFO: FIXConnection.sendMessage(fixID=sama): pt=1, fixSendTime=1161153004438, msg=8=FIX.4.2^A9=190^A35=D^A49=012^A56=
SAMA^A115=012^A34=294^A116=I0120002^A144=2^A52=20061018-06:30:04.413^A11=020I80A3400^A1=1200212023^A63=1^A21=1^A55=2170^A54=2^A60=20061018-06:30:04^A38=317^A
40=2^A44=43.5^A59=0^A386=1^A336=510^A10=059^A



i have a file like this I need to get the Bold time in a Varibale and the 11=020I80A3400 also in A varibale so please Help me to do that please
  #2 (permalink)  
Old 10-18-2006
napolayan napolayan is offline
Registered User
  
 

Join Date: Oct 2006
Location: Bangalore, India
Posts: 41
the following will only work if the pattern in bold occurs in the specified places always n the length of the pattern also remains same. m is the file in which i have stored the file u had given.
x=`sed -n 1p m|awk -F"^" '{print $1}'|cut -c 1-12`
y=`sed -n 2p m|awk -F"^" '{print $7}'|cut -c 2-14`

so plz specify the exact nature of the problem
  #3 (permalink)  
Old 10-18-2006
habuzahra habuzahra is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 29
I have a tag in the file it's 35=D before this tag i have the time of the tag which I mentioned about it before and after the 35=D I have another tag which is 11=some string ex(11=0011IN)
so the file look like that

09:30:04,438 INFO : FIXEngine[engine1]: INFO: FIXConnection.sendMessage(fixID=sama): pt=1, fixSendTime=1161153004438, msg=8=FIX.4.2^A9=190^A35=D^A49=012^A56=
SAMA^A115=012^A34=294^A116=I0120002^A144=2^A52=20061018-06:30:04.413^A11=020I80A3400^A1=1200212023^A63=1^A21=1^A55=2170^A54=2^A60=20061018-06:30:04^A38=317^A
40=2^A44=43.5^A59=0^A386=1^A336=510^A10=059^A

and usually 35=D is in the same line of the Time and the 11=111111 in the next line


so Please I need Help

Last edited by habuzahra; 10-18-2006 at 09:57 AM..
  #4 (permalink)  
Old 10-18-2006
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
sed -n "/35=D/{N;/11=/{s/^\([^ ]*\).*\n.*\(11=[^^]*\).*$/\1 \2/p;};}" file
  #5 (permalink)  
Old 10-18-2006
ravikirankethe ravikirankethe is offline
Registered User
  
 

Join Date: Oct 2006
Location: NewYork
Posts: 21
Unhappy

Can you please explain your statement. By looking at that, it is complex to understand.
  #6 (permalink)  
Old 10-18-2006
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Quote:
Originally Posted by ravikirankethe
Can you please explain your statement. By looking at that, it is complex to understand.
/35=D/{...}

If the line contains the pattern 35=D then execute the commands within the paranthesis.

N

get the next line and append it to the pattern space

/11=/{..}

If the pattern space contains the pattern 11= then execute the commands within the paranthesis.


s/^\([^ ]*\).*\n.*\(11=[^^]*\).*$/\1 \2/p

What we need in the first line is "09:30:04,438" which is separated from next word by space. This string is matched by \([^ ]*\). The next string is matched by \(11=[^^]*\) which is separated from the next field by ^.
  #7 (permalink)  
Old 10-18-2006
ravikirankethe ravikirankethe is offline
Registered User
  
 

Join Date: Oct 2006
Location: NewYork
Posts: 21
Thanks Anbu !!
BTW, Habuzahra, are you able to continue your work?
Sponsored Links
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 02:29 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