Sponsored Content
Full Discussion: Count certain lines
Top Forums Shell Programming and Scripting Count certain lines Post 302432753 by bartus11 on Saturday 26th of June 2010 02:25:17 PM
Old 06-26-2010
Code:
awk '/^\[/{s+=1;next}{if (s!=0) print s;s=0}' file

This User Gave Thanks to bartus11 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to count lines - ignoring blank lines and commented lines

What is the command to count lines in a files, but ignore blank lines and commented lines? I have a file with 4 sections in it, and I want each section to be counted, not including the blank lines and comments... and then totalled at the end. Here is an example of what I would like my... (6 Replies)
Discussion started by: kthatch
6 Replies

2. Shell Programming and Scripting

Parse and count lines

I have a data file in the following format (refer to input file) with multiple lines containing some information. I need an output file to loop thorough the input file with summarized information as seen below (refer to output file) ‘Date Time' and ‘Beta Id' input file values should be concatenated... (7 Replies)
Discussion started by: shekharaj
7 Replies

3. Shell Programming and Scripting

Count the no of lines between two words

Please help in the following problem: Input is: Pritam 123 456 Patil myname youname Pritam myproject thisproject iclic Patil remaining text some more text I need the command which will display the no of lines between two words in the whole file. e.g. Display all the no of lines... (5 Replies)
Discussion started by: zsudarshan
5 Replies

4. Shell Programming and Scripting

count lines in a pattern

Hi, I had posted few days back and got replies on how to extract patterns from a file. I had another question. I want to count the number of lines a particular pattern. I thought of somethings like using NF variable, etc, but they didnt work. Here is sample input. ... (9 Replies)
Discussion started by: sandeepk1611
9 Replies

5. Solaris

WC -l does not count all the lines in a file? HELP

I have a file that I need to merge with another like file. Normally I remove the trailer reocrd and merge the file and update the trailer record of the second file. I did a WC -l on the first file before I removed the trailer record, and again afterwards. The count came back the same. I opened the... (6 Replies)
Discussion started by: Harleyrci
6 Replies

6. Shell Programming and Scripting

Count lines and use if then ksh

I try to count number of lines of a data.txt file and then if number of lines is greater than 1 then email me the file. I could not find what is wrong with my code, hope you can point out the mistake i made #! /bin/ksh count =`cat /from/file/data.txt | wc -l` if ]; then mailx -s... (4 Replies)
Discussion started by: sabercats
4 Replies

7. Shell Programming and Scripting

Count lines containing substring

I have 2 files, and I want to count how many lines contain matching words. Example: file1 a_+b a_+b_+c file2 ab a_+b a_+bc I want to get 1, as the the first line of file1 is a substring of the first line of file2. While the second line isn't. I suspect using sdiff, but not sure how to... (3 Replies)
Discussion started by: Viernes
3 Replies

8. Shell Programming and Scripting

Count lines

Hello, I have a file with two columns like the following FILE1: chr1 61042 chr1 61153 chr1 61446 chr1 61457 chr1 61621 chr10 61646 chr10 61914 chr10 62024 chr10 62782 Alos, I have another file FILE2: (13 Replies)
Discussion started by: rkk
13 Replies

9. UNIX for Advanced & Expert Users

Count no. of lines of execution

Hi all, I have my script to execute number of commands (command line interface) using TCL. the execution and response of the commands get stored in some log file. While the execution is going on i need only the time of execution and the number of line getting executed to be displayed in... (1 Reply)
Discussion started by: Syed Imran
1 Replies

10. Shell Programming and Scripting

Count lines in section

I am tiring to cont numbers of line between the "!" in CISCO routers I have no problem to extract the input and change the empty line with ! ! 5 Cable5/0/1 U0 4 5 Cable5/0/1 U1 4 ! 5 Cable5/0/1 U2 4 ... (4 Replies)
Discussion started by: sharong
4 Replies
PERROR(3F)																PERROR(3F)

NAME
perror, gerror, ierrno - get system error messages SYNOPSIS
subroutine perror (string) character*(*) string subroutine gerror (string) character*(*) string character*(*) function gerror() function ierrno() DESCRIPTION
Perror will write a message to fortran logical unit 0 appropriate to the last detected system error. String will be written preceding the standard error message. Gerror returns the system error message in character variable string. Gerror may be called either as a subroutine or as a function. Ierrno will return the error number of the last detected system error. This number is updated only when an error actually occurs. Most routines and I/O statements that might generate such errors return an error code after the call; that value is a more reliable indicator of what caused the error condition. FILES
/usr/lib/libU77.a SEE ALSO
intro(2), perror(3) D. L. Wasley, Introduction to the f77 I/O Library BUGS
String in the call to perror can be no longer than 127 characters. The length of the string returned by gerror is determined by the calling program. NOTES
UNIX system error codes are described in intro(2). The f77 I/O error codes and their meanings are: 100 ``error in format'' 101 ``illegal unit number'' 102 ``formatted i/o not allowed'' 103 ``unformatted i/o not allowed'' 104 ``direct i/o not allowed'' 105 ``sequential i/o not allowed'' 106 ``can't backspace file'' 107 ``off beginning of record'' 108 ``can't stat file'' 109 ``no * after repeat count'' 110 ``off end of record'' 111 ``truncation failed'' 112 ``incomprehensible list input'' 113 ``out of free space'' 114 ``unit not connected'' 115 ``invalid data for integer format term'' 116 ``invalid data for logical format term'' 117 ``'new' file exists'' 118 ``can't find 'old' file'' 119 ``opening too many files or unknown system error'' 120 ``requires seek ability'' 121 ``illegal argument'' 122 ``negative repeat count'' 123 ``illegal operation for unit'' 124 ``invalid data for d, e, f, or g format term'' 4.2 Berkeley Distribution June 7, 1985 PERROR(3F)
All times are GMT -4. The time now is 04:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy