Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Counting no of lines between two strings in a file Post 302209498 by santyshyam on Friday 27th of June 2008 06:42:06 AM
Old 06-27-2008
Question Counting no of lines between two strings in a file

Hi all,

I'm very very new to UNIX and AWK world.Please help me in finding a solution for my problem.
I'm having a file like this
-----------------------------------------------------------------
~Version Information
VERS. 2.0: CWLS log ASCII Standard -VERSION 2.0
WRAP. YES: Multiple lines per depth step
~Well Information Block
#MNEM.UNIT Data Type Information
#--------- ----------- ---------------------------
STRT.M -0.9144:
STOP.M 1103.6830:
STEP.M 0.0762:
NULL. -999.2500:
UWI . xxxxxxxxxxxxxxxxx: UWI
CWN .
WELL. UNKNOWN: WELL NAME
~Parameter Information Block
#MNEM.UNIT Value Description
#--------- ----------- ---------------------------
~Curve Information Block
#MNEM.UNIT API CODE Curve Description
#--------- ----------- ---------------------------
wwww.M 00 000 000 000: xxxxxxxxxxxxxx
AX.MM 00 000 000 000: xxxxxxxxxxxxxx
xxxx . 00 000 000 000: xxxxxxeeeeeeee
xtyy .GAPI 00 000 000 000: gtgtgvgvhjuipi
wwvv . 00 000 000 000:
~A
-0.9144
-999.2500 -999.2500 45.9415 -999.2500
-0.8382
-999.2500 -999.2500 55.3639 -999.2500
-0.7620
-999.2500 -999.2500 64.7864 -999.2500
-0.6858
-999.2500 -999.2500 74.2088 -999.2500
-0.6096
-999.2500 -999.2500 83.6312 -999.2500
-0.5334
-999.2500 -999.2500 93.0536 -999.2500
-0.4572
-999.2500 -999.2500 90.0697 -999.2500
-0.3810
-999.2500 -999.2500 79.5008 -999.2500
-0.3048
-999.2500 -999.2500 68.9319 -999.2500
-0.2286
-999.2500 -999.2500 64.3118 -999.2500
-0.1524
-999.2500 -999.2500 64.3118 -999.2500
-0.0762
-999.2500 -999.2500 64.3118 -999.2500
0.0000
-999.2500 -999.2500 64.3118 -999.2500
0.0762
-999.2500 -999.2500 64.3118 -999.2500
0.1524
-999.2500 -999.2500 65.0113 -999.2500
0.2286
--------------------------------------------------------
Wanted to count the lines between ~Curve Information Block and ~A
and i need a count of no of lines between these two.
I need an output file with the filename and the no of lines present between these 2 pattern.
The no of lines between these patterns can vary.........
I need to do this for morethan 1000 files............
I belive an awk code or Shell script can help me in this..........

Thanks in advance..........
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting The Number Of Duplicate Lines In a File

Hello. First time poster here. I have a huge file of IP numbers. I am trying to output only the class b of the IPs and rank them by most common and output the total # of duplicate class b's before the class b. An example is below: 12.107.1.1 12.107.9.54 12.108.3.89 12.109.109.4 12.109.6.3 ... (2 Replies)
Discussion started by: crunchtime
2 Replies

2. UNIX for Dummies Questions & Answers

Counting occurences of different strings in a file

Hi, i'd like to know if the following is possible with a shell script, and can't find the answer in the search. Suppose i have a logfile build like this: # 8 :riuyzp1028 # 38 : riuyzp1028 # 25 : riuyvzp1032 # 30 : nlkljpa0202 # 1 : nlklja0205 # 38 : riuyzp1028 # 25 :... (4 Replies)
Discussion started by: Freerider
4 Replies

3. Shell Programming and Scripting

Extracting the lines between 2 strings of a file

Hi, I have a sql file and i need to extract the table names used in the sql file using a unix script. If i can extract the lines between the keywords 'FROM' and 'WHERE' in the file, my job is done. can somebody tell me how to do this using a shell script. If u can just let me know, how to... (2 Replies)
Discussion started by: babloo
2 Replies

4. Shell Programming and Scripting

Counting similar lines from file UNIX

I have a file which contains data as below: nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf nbk1j7o pageName=/jsp/common/index.jsf nbk1j7o pageName=/jsp/common/index.jsf nbk1wqe... (6 Replies)
Discussion started by: mohsin.quazi
6 Replies

5. Shell Programming and Scripting

Adding strings to lines in a file

Hi all, I have a positional text file that comes from some source application. Before it is processed by destination application I have to add some header (suffix) to every record(line) in the file. e.g. Actual File ............... AccountDetails AcNO Name Amount 1234 John 26578 5678... (3 Replies)
Discussion started by: sharath160
3 Replies

6. Shell Programming and Scripting

Counting lines in each block file

hello im new here so i want to say hi everybody :) i have to write a script and im newbie :/ i hope that in this forum are many ppl who knows subject :) i have hundrets folders. in each folder is a file name trace.txt. each trace.txt has a lot of tracert's results separates with "-----" it... (6 Replies)
Discussion started by: michael8484
6 Replies

7. UNIX for Dummies Questions & Answers

Counting no. of lines and printing it at the start of the file

Dear users, I need to count the number of lines in a simple text file and print the number on the first line of that same file. I know I can count the lines using wc -l file.txt this gives for example 100 file.txt I need the number 100 to be printed at the very top of file.txt... (2 Replies)
Discussion started by: jenjen_mt
2 Replies

8. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

9. Shell Programming and Scripting

Counting a string between 2 strings...

I have been working on this for a little while and have been unable to come to a solution. Any help would be appreciated. I am working on a UNIX workstation and have a 30-40 meg text file that I am working with. In my real file there is hundreds of Jobs. Example of input file; misc logging data... (1 Reply)
Discussion started by: ny_evan
1 Replies

10. Shell Programming and Scripting

Counting lines in a file using awk

I want to count lines of a file using AWK (only) and not in the END part like this awk 'END{print FNR}' because I want to use it. Does anyone know of a way? Thanks a lot. (7 Replies)
Discussion started by: guitarist684
7 Replies
DMASCC_CFG(1)						     Linux Programmer's Manual						     DMASCC_CFG(1)

NAME
dmascc_cfg - Configure dmascc devices SYNOPSIS
dmascc <interface> [<options>] DESCRIPTION
dmascc_cfg is used to configure dmascc devices such as PI2 and PackeTwin cards. The --show option can be used by any user, all other options must be used by root. OPTIONS
--speed frequency Set frequency of baud rate generator to frequency. A value of 0 disables the baud rate generator and the digital PLL. Use the --show option to check whether the frequency you selected could be approximated with sufficient accuracy. --nrzi [0|1] 0 selects NRZ mode, 1 selects NRZI mode. --clocks integer Set the clock mode. You may OR together three choices (other values are not supported and may cause strange results). TX clock pin: 0x00 input 0x05 output TX clock * 0x06 output baud rate generator * 0x07 output digital PLL * TX clock source: 0x00 RX clock pin 0x08 TX clock pin # 0x10 baud rate generator 0x18 digital PLL + RX clock source: 0x00 RX clock pin 0x20 TX clock pin 0x40 baud rate generator 0x60 digital PLL + * Not allowed on PI2 Port A if J3 is installed. # TX clock pin must be configured as input. + Speed must be equal to 32 times the baud rate. --txdelay milliseconds Set transmit delay to milliseconds. Maximum is 2500 ms. --txtime seconds Set maximum time the transmitter may be active to seconds. --sqdelay milliseconds Set the squelch delay to milliseconds. Maximum delay is 2500 ms. --slottime milliseconds Set the slot time to milliseconds. Maximum slottime is 2500 ms. --waittime milliseconds Set the minimum time between the transmitter turning off to when it turns on to milliseconds. Maximum wait time is 2500 ms. --persist f Set the persistance parameter to f. Must be between 0 and 255 (inclusive). --dma channel Set the DMA channel to channel. Can be 1 or 3. Setting to 0 disables DMA. BUGS
dmascc_cfg does not check the parameters for validity. The driver or kernel may crash if you specify invalid values. AUTHORS
Klaus Kudielka This manual page written by Craig Small <csmall@small.dropbear.id.au> Linux 30 June 1999 DMASCC_CFG(1)
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy