Sponsored Content
Top Forums Shell Programming and Scripting Get the number of lines till I get line Post 302585721 by arunshankar.c on Thursday 29th of December 2011 06:22:13 AM
Old 12-29-2011
Get the number of lines till I get line

Hi All,

I have a file as below:

Code:
abc.txt

******************************
*        HEADER DESCRIPTION
******************************
*Supplier:        Prism
Customer:         MNI -NIGERIA
Quantity:         2
Type:             PLUG-IN
Profile:          70.00
*Subscription:    Generic
Graph_ref:        70.01
*City:            LGHLR1
Batch:            13597
Transport_Key:    8
*
Productcode:      VTM
DATE CREATED:     7/12/2011 10:18:39 AM
Expiry DATE:
*
Address1:
Address2:
Address3:
Address4:
*
PO_ref_number:    1207PVT
HolderId_1:
HolderId_2:
HolderId_3:
HolderId_4:
*
PIN1:              00000
PIN2:              00000
PUK1:              RANDOM
PUK2:              RANDOM
******************************
*        INPUT VARIABLES
******************************
Var_in_list:
IMSI:              621300020985821
Ser_nb:            8923401000117943621
Kitnb:             0117943621
******************************
*        OUTPUT VARIABLES
******************************
Kitnb/ICCID1/ICCID2/IMSI1/IMSI2/MSISDN1/MSISDN2/VOUCHER1/VOUCHER2
0117943621,89234010001179436212,,621300020985821,,2347064000500,,,
0117943622,89234010001179436213,,621300020985822,,2347064000501,,,
0117943623,89234010001179436214,,621300020985823,,2347064000502,,,
0117943624,89234010001179436215,,621300020985824,,2347064000503,,,
0117943625,89234010001179436216,,621300020985825,,2347064000504,,,
0117943626,89234010001179436217,,621300020985826,,2347064000505,,,
0117943627,89234010001179436218,,621300020985827,,2347064000506,,,
0117943628,89234010001179436219,,621300020985828,,2347064000507,,,
0117943629,89234010001179436220,,621300020985829,,2347064000508,,,
0117943630,89234010001179436221,,621300020985830,,2347064000509,,,
0117943631,89234010001179436222,,621300020985831,,2347064000510,,,

Can someone please guide me to ensure that I get the number of lines till I get line : Kitnb/ICCID1/ICCID2/IMSI1/IMSI2/MSISDN1/MSISDN2/VOUCHER1/VOUCHER2
i.e without counting the line :
Kitnb/ICCID1/ICCID2/IMSI1/IMSI2/MSISDN1/MSISDN2/VOUCHER1/VOUCHER2

I know a way to use perl script by running through a for loop. But, that affects performance. Can some one please help me to do the same in awk.

Thanks in advance
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

display lines after a particular line number

I have a file that has 1k lines and i want to print all the lines after 900th line. an 2)I want to move files f1 ,f2,f3,f4 to p1,p2,p3,p4 Please give me the commands. Thanx in adv. (6 Replies)
Discussion started by: rajashekar.y
6 Replies

2. UNIX for Dummies Questions & Answers

Read lines till a blank line is encountered

Hi, I have reached at a specified offset from the start of file. My requirement is that I want to read only those lines, which have the string READ / ALTER / UPDATE. As soon as, none of these literals are found in the subsequent line, I want to stop reading. Is there any feature of grep which... (1 Reply)
Discussion started by: saurabhsinha23
1 Replies

3. Shell Programming and Scripting

Appending line number to each line and getting total number of lines

Hello, I need help in appending the line number of each line to the file and also to get the total number of lines. Can somebody please help me. I have a file say: abc def ccc ddd ffff The output should be: Instance1=abc Instance2=def Instance3=ccc Instance4=ddd Instance5=ffff ... (2 Replies)
Discussion started by: chiru_h
2 Replies

4. Shell Programming and Scripting

How to print lines till till a pattern is matched in loop

Dear All I have a file like this 112534554 446538656 444695656 225696966 226569744 228787874 113536566 443533535 222564552 115464656 225445345 225533234 I want to cut the file into different parts where the first two columns are '11' . The first two columns will be either... (3 Replies)
Discussion started by: anoopvraj
3 Replies

5. Shell Programming and Scripting

add number in lines line by line in different files

I have a set of log files that are in the following format ======= set_1 ======== counter : 315 counter2: 204597 counter3: 290582 ======= set_2 ======== counter : 315 counter2: 204597 counter3: 290582 ======= set_3 ======== counter : 315 counter2: 204597 counter3: 290582 Is... (6 Replies)
Discussion started by: grandguest
6 Replies

6. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

7. Shell Programming and Scripting

fish out lines according to line number

Dear all, I've a situation here, I have a big file which contains about 20Million line as shown as below I want to fish out some lines according to the line position of the big file, for example here line number 3,4,7 ... so the expected output will be like this currently I manage to... (3 Replies)
Discussion started by: masterpiece
3 Replies

8. Shell Programming and Scripting

print lines between line number

Hi, Anyone help me to print the lines from the flat file between 879th line number and 1424th line number. The 879 and 1424 should be passed as input to the shell script(It should be dynamic). Can any one give me using sed or awk? I tried using read, and print the lines..Its taking too... (3 Replies)
Discussion started by: senthil_is
3 Replies

9. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

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

10. Shell Programming and Scripting

Read line with particular number of lines

Hi all, I have a file sample.txt abc asd adf daf adw add adv wdf I want to control the number of lines to read Like if i give input as ./script_name 2 5 required output asd adf daf (2 Replies)
Discussion started by: krux_rap
2 Replies
measurefs.reiser4(8)						reiser4progs manual					      measurefs.reiser4(8)

NAME
measurefs.reiser4 - the program for measuring reiser4 filesystem parameters (fragmentation, node packing, etc.). SYNOPSIS
measurefs.reiser4 [ options ] FILE DESCRIPTION
measurefs.reiser4 is reiser4 filesystem measure program. You can estimate reiser4 filesystem fragmentation, packingm etc. structures by using it. COMMON OPTIONS
-V, --version prints program version. -?, -h, --help prints program help. -y, --yes assumes an answer 'yes' to all questions. -f, --force forces measurefs to use whole disk, not block device or mounted partition. -c, --cache N sets tree cache node number to passed value. This affects very much behavior of libreiser4. It affects speed, tree allocation, etc. MEASUREMENT OPTIONS
-S, --tree-stat shows different tree statistics (node packing, internal nodes, leaves, etc) -T, --tree-frag measures total tree fragmentation. The result is fragmentation factor - value from 0.00000 (minimal fragmentation) to 1.00000 (maxi- mal one). Most probably, this factor may affect sequential read performance. -D, --data-frag measures average files fragmentation. This means, that fragmentation of each file in filesystem will be measured separately and results will be averaged. The result is fragmentation factor - value from 0.00000 (minimal fragmentation) to 1.00000 (maximal one). Note, that for the fresh filesystem (created not very long time ago) and even fully filled by data, this value will be pretty small. -F, --file-frag FILE measures fragmentation of the specified file. The result is fragmentation factor - value from 0.00000 (minimal fragmentation) to 1.00000 (maximal one). Note, that fragmentation of a small file (depends of used tail policy), which consists of tail items, is not very reliable value. That is because, they is always afoot due to balancing. Examples: measurefs.reiser4 -F /usr/bin /dev/hda2 measurefs.reiser4 -F /bin/bash /dev/hda2 -E, --show-file show file fragmentation for each file if --data-frag is specified. PLUGIN OPTIONS
-p, --print-profile prints the plugin profile. This is the set of default plugins used for all parts of a filesystem -- format, nodes, files, directo- ries, hashes, etc. If --override is specified, then prints modified plugins. -l, --print-plugins prints all plugins libreiser4 know about. -o, --override TYPE=PLUGIN, ... overrides the default plugin of the type "TYPE" by the plugin "PLUGIN" in the plugin profile. Examples: measurefs.reiser4 -o nodeptr=nodeptr41,hash=rupasov_hash /dev/hda2 REPORTING BUGS
Report bugs to <reiserfs-devel@vger.kernel.org> SEE ALSO
debugfs.reiser4(8), mkfs.reiser4(8), fsck.reiser4(8) AUTHOR
This manual page was written by Yury Umanets <umka@namesys.com> reiser4progs 28 Apr, 2003 measurefs.reiser4(8)
All times are GMT -4. The time now is 01:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy