Sponsored Content
Top Forums Shell Programming and Scripting print all the rows from "BUY" Tag with "SELL" with Buy/sell tag at end Post 302330756 by r_t_1601 on Thursday 2nd of July 2009 08:12:00 AM
Old 07-02-2009
print all the rows from "BUY" Tag with "SELL" with Buy/sell tag at end

hi I have the following input and i want to print all the rows from "BUY" Tag till "SELL" alongwith Buy/sell tag at end of each row

Code:
------
INPUT
=====
30/06/2009,NORMAL,ALL,ALL
BUY
1,CBLO/020709,T+0,30/06/2009,100.00,3.00,999835643.46,200906300000422,-, 15:04:42,BUY
2,CBLO/020709,T+0,30/06/2009,100.00,3.01,999835095.69,200906300000421,-, 15:04:42,BUY
3,CBLO/020709,T+0,30/06/2009,10.00,2.90,99984112.11,200906300000296,-, 13:32:34,BUY
4,CBLO/020709,T+0,30/06/2009,100.00,2.90,999841121.14,200906300000295,-, 13:32:34,BUY
5,CBLO/020709,T+0,30/06/2009,50.00,2.90,499920560.57,200906300000294,-, 13:32:34,BUY
6,CBLO/020709,T+0,30/06/2009,30.00,2.91,299952172.01,200906300000293,-, 13:32:34,BUY
SELL
1,CBLO/020709,T+0,30/06/2009,40.00,3.24,399928998.91,200906300000038,-, 09:47:22,SELL
2,CBLO/020709,T+0,30/06/2009,50.00,3.24,499911248.63,200906300000037,-, 09:47:22,SELL
3,CBLO/020709,T+0,30/06/2009,10.00,3.24,99982249.73,200906300000036,-, 09:47:22,SELL
4,CBLO/020709,T+0,30/06/2009,100.00,3.25,999821949.52,200906300000024,-, 09:31:09,SELL
5,CBLO/020709,T+0,30/06/2009,100.00,3.25,999821949.52,200906300000023,-, 09:31:09,SELL
6,CBLO/020709,T+0,30/06/2009,100.00,3.10,999830165.83,200906300000007,-, 09:11:55,SELL
7,CBLO/020709,T+0,30/06/2009,200.00,3.10,1999660331.67,200906300000006,-, 09:11:49,SELL
8,CBLO/020709,T+0,30/06/2009,200.00,3.05,1999665809.28,200906300000002,-, 09:11:28,SELL
390.00,800.00
3899368704.98,7998622703.09

====================================
OUTPUT
======
1,CBLO/020709,T+0,30/06/2009,100.00,3.00,999835643.46,200906300000422,-, 15:04:42,BUY
2,CBLO/020709,T+0,30/06/2009,100.00,3.01,999835095.69,200906300000421,-, 15:04:42,BUY
3,CBLO/020709,T+0,30/06/2009,10.00,2.90,99984112.11,200906300000296,-, 13:32:34,BUY
4,CBLO/020709,T+0,30/06/2009,100.00,2.90,999841121.14,200906300000295,-, 13:32:34,BUY
5,CBLO/020709,T+0,30/06/2009,50.00,2.90,499920560.57,200906300000294,-, 13:32:34,BUY
6,CBLO/020709,T+0,30/06/2009,30.00,2.91,299952172.01,200906300000293,-, 13:32:34,BUY
1,CBLO/020709,T+0,30/06/2009,40.00,3.24,399928998.91,200906300000038,-, 09:47:22,SELL
2,CBLO/020709,T+0,30/06/2009,50.00,3.24,499911248.63,200906300000037,-, 09:47:22,SELL
3,CBLO/020709,T+0,30/06/2009,10.00,3.24,99982249.73,200906300000036,-, 09:47:22,SELL
4,CBLO/020709,T+0,30/06/2009,100.00,3.25,999821949.52,200906300000024,-, 09:31:09,SELL
5,CBLO/020709,T+0,30/06/2009,100.00,3.25,999821949.52,200906300000023,-, 09:31:09,SELL
6,CBLO/020709,T+0,30/06/2009,100.00,3.10,999830165.83,200906300000007,-, 09:11:55,SELL
7,CBLO/020709,T+0,30/06/2009,200.00,3.10,1999660331.67,200906300000006,-, 09:11:49,SELL
8,CBLO/020709,T+0,30/06/2009,200.00,3.05,1999665809.28,200906300000002,-, 09:11:28,SELL

 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

5. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

6. Shell Programming and Scripting

find files in sub dir with tag & add "." at the beginning [tag -f "Note" . | xargs -0 {} mv {} .{}]

I am trying find files in sub dir with certain tags using tag command, and add the period to the beginning. I can't use chflags hidden {} cause it doesn't add period to the beginning of the string for web purpose. So far with my knowledge, I only know mdfind or tag can be used to search files with... (6 Replies)
Discussion started by: Nexeu
6 Replies
Agent::Tag(3pm) 					User Contributed Perl Documentation					   Agent::Tag(3pm)

NAME
Log::Agent::Tag - formats caller information SYNOPSIS
Intended to be inherited from DESCRIPTION
This class is meant to be inherited by all the classes implementing a log message tag. A message tag is a little string that is either appended or prepended to all log messages. For instance, and oversimplifying a bit, a tag meant to be prepended will be inserted in front of the current log message, separated by separator, which defaults to a single space: +------------+-----------+---------------------------------+ | tag string | separator | current log message | +------------+-----------+---------------------------------+ This operation is called tag insertion. The whole string then becomes the current log message, and can be the target of another tag insertion. The reality is a little bit more complex, to allow successive tags to be prepended or appended in the order they are specified, and not in reverse order as they would be if naively implemented. See Log::Agent::Message for the exact semantics of append() and prepend() operations. FEATURES
This section documents the interface provided to heirs, in case you wish to implement your own tag class. _init(name, postfix, separator) Initialization routine that should be called by all heirs during creation to initialize the common attributes. postfix When true, the tag is meant to be appended to the log message. Otherwise, it is prepended. name The name of this tag. It is meant to provide by-name access to tags, check whether a given tag is recorded, etc... The names "caller" and "priority" are architecturally defined to refer to "Log::Agent::Tag::Caller" and "Log::Agent::Tag::Priority" objects. NOTE: Currently unused by any client code. separator The sperating string inserted between the tag and the log message. It defaults to " " if not specified, i.e. left to "undef" when calling _init(). string() A deferred routine, to be implemented by heirs. Returns the tag string only, without the separator, since its exact placement depends on the value of the "postfix" attribute. insert(message) Insert this tag withing the "Log::Agent::Message" message, according to the tag specifications (placement, separator). Calls string() to produce the tag string. This routine is frozen and should not be redefined by heirs. STANDARD TAGGING CLASSES
Tagging classes define via their "string()" routine what is the string to be used as a tag. The insertion of the tag within the log message is done via a frozen routine from the "Log::Agent::Tag" ancestor. The following classes are provided by "Log::Agent": "Log::Agent::Tag::Callback" The "string()" routine invokes a user-supplied callback, given as a "Callback" object. You need the Callback module from CPAN if you wish to use this class. "Log::Agent::Tag::Caller" Used internally to compute the caller and format it according to user specifications. "Log::Agent::Tag::Priority" Used internally to format message priorities and add them to the log messages. "Log::Agent::Tag::String" Defines a constant tagging string that should be added in all the log messages, e.g. a web session ID. AUTHOR
Raphael Manfredi <Raphael_Manfredi@pobox.com> SEE ALSO
Log::Agent::Message(3). perl v5.10.0 2002-03-09 Agent::Tag(3pm)
All times are GMT -4. The time now is 07:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy