06-10-2009
sort group of n lines base on pattern in first line
I have record having 10 fields and each field being printed on a new line, first line cotains name of exchange, 2nd line stock name, third line stock price, etc etc...
now i want to retrieve data only for a particular exchanged and that too only 2nd and 3rd row info...
NSE
RNRL
70
12
1
GROUP
..
..
BSE
RIT
20
12
...
..
..
NSE
BITS
70
12
1
GROUP
..
..
in the outout i was only the next 2 lines following NSE, in the whole file, so output should be like
RNRL
70
BITS
70
any suggestions...
thanks in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I've this file and need to sort the data in each group
File would look like this ...
cat file1.txt
Reason : ABC
12345-0023
32123-5400
32442-5333
Reason : DEF
42523-3453
23345-3311
Reason : HIJ
454553-0001
I would like to sort each group on the last 4 fileds and print them... (11 Replies)
Discussion started by: prash184u
11 Replies
2. UNIX for Advanced & Expert Users
Hi Everybody,
Below are the contents of the a text file ..,
SN = 8
MSI = 405027002277133
IKVALUE = DE6AA6A11D42B69DF6398D44B17BC6F2
K4SNO = 2
CARDTYPE = SIM
ALG = COMP128_3
SN = 8
MSI = 405027002546734
IKVALUE = 1D9F8BAA73973D8FBF8CBFB01436D822
K4SNO = 2
CARDTYPE = SIM
ALG =... (8 Replies)
Discussion started by: prasanth_babu
8 Replies
3. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
4. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
5. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
6. Shell Programming and Scripting
Dear All,
I have a requests to retrieve all lines if second line last columns meets certain criteria.
Here is the output of the result
Table: DSSBDW.DA_MASK_CLK_AR
120908 0 86 86 - 1934528 0 70 100 -*-
Table: DSSBDW.DA_MASK_CLK_IP
310657 22030 143 185 - 5281169 7 88 77 *-*
Table:... (5 Replies)
Discussion started by: ckwan123
5 Replies
7. Shell Programming and Scripting
I am trying to combine lines with these conditions:
1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text.
2. If condition1 is met then continue to combine lines through a line that ends with a semicolon.
3. Ignore case when matching patterns and remove any... (5 Replies)
Discussion started by: Wes Kem
5 Replies
8. Shell Programming and Scripting
Hi Guys,
I am trying to format my csv file. When I spool the file using sqlplus the single row output is wrapped on three lines.
Somehow I managed to format that file and finally i am trying to make the multiple line on single line.
The below command is working fine but I need to pass the... (3 Replies)
Discussion started by: RJSKR28
3 Replies
9. UNIX for Beginners Questions & Answers
Input file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field.
i am using centos 7 Operating system.
want to read below file.
# cat /tmp/d5
NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
LEARN ABOUT DEBIAN
finance::quote::financecanada
Finance::Quote::FinanceCanada(3pm) User Contributed Perl Documentation Finance::Quote::FinanceCanada(3pm)
NAME
Finance::Quote::FinanceCanada - Obtain stock and mutual fund prices from finance.canada.com
SYNOPSIS
use Finance::Quote;
$q = Finance::Quote->new;
# Can failover to other methods
%quotes = $q->fetch("canada", "stock_fund-code");
# Use this module only
%quotes = $q->fetch("financecanada", "stock_fund-code");
DESCRIPTION
This module obtains information about Canadian Stock and Mutual Funds from finanace.canada.com. The information source "canada" can be
used if the information source is unimportant, or "financecanada" to specifically use finance.canada.com.
STOCK_FUND-CODE
Canadian stocks/mutual funds do not have a unique symbol identifier. This module uses the symbols as used on finance.canada.com. The
simplest way to fetch the ID for a particular stock/fund is to go to finance.canada.com, search for your particular stock or mutual fund,
and note the symbol ID. This is helpfully provided by the site in their returned HTML quote.
LABELS RETURNED
Information available from financecanada may include the following labels:
method source name symbol currency date nav last price
SEE ALSO
Finance Canada.com website - http://finance.canada.com/
Finance::Quote
perl v5.14.2 2012-05-06 Finance::Quote::FinanceCanada(3pm)