Sponsored Content
Top Forums Shell Programming and Scripting Appending line number to each line and getting total number of lines Post 302178115 by shamrock on Monday 24th of March 2008 04:47:03 PM
Old 03-24-2008
Code:
awk '{print "Instance"NR"="$0} END {print "Total number of Instances = "NR}' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Appending the line number and a seperator to each line of a file ?

Hi, I am a newb as far as shell scripting and SED goes so bear with me on this one. I want to basically append to each line in a file a delimiter character and the line's line number e.g Change the file from :- aaaaaa bbbbbb cccccc to:- aaaaaa;1 bbbbbb;2 cccccc;3 I have worked... (4 Replies)
Discussion started by: pjcwhite
4 Replies

2. Shell Programming and Scripting

Adding a columnfrom a specifit line number to a specific line number

Hi, I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers. To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello"... (2 Replies)
Discussion started by: Ezy
2 Replies

3. Shell Programming and Scripting

how to get the data from line number 1 to line number 100 of a file

Hi Everybody, I am trying to write a script that will get some perticuler data from a file and redirect to a file. My Question is, I have a Very huge file,In that file I have my required data is started from 25th line and it will ends in 100th line. I know the line numbers, I need to get all... (9 Replies)
Discussion started by: Anji
9 Replies

4. 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

5. UNIX for Dummies Questions & Answers

How to read contents of a file from a given line number upto line number again specified by user

Hello Everyone. I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below: if ; then if ; then tail +$1 $3 | head -n $2 else ... (5 Replies)
Discussion started by: grc
5 Replies

6. Shell Programming and Scripting

Increasing a number and appending it to next line of a text file

Hi all, I have text file having a number P100. what i need is when i run a script, it should add 1 to the above number and append it to the next line of a same text file.. when i use the script next time it should check the last line and add 1 to the last number and so on.. like the text... (5 Replies)
Discussion started by: smarty86
5 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

Write $line number into textfile and read from line number

Hello everyone, I don't really know anything about scripting, but I have to manage to make this script, out of necessity. #!/bin/bash while read -r line; do #I'm reading from a big wordlist instructions using $line done Is there a way to automatically write the $line number the script... (4 Replies)
Discussion started by: bobylapointe
4 Replies

10. Shell Programming and Scripting

Cut from specific line number to a line number

Hi All, I've a file like this.. Sheet1 a,1 a,2 a,3 a,4 a,5 Sheet2 a,6 a,7 a,8 a,9 a,10 Sheet3 a,11 a,12 a,13 (7 Replies)
Discussion started by: manab86
7 Replies
Perl::Critic::Statistics(3)				User Contributed Perl Documentation			       Perl::Critic::Statistics(3)

NAME
Perl::Critic::Statistics - Compile stats on Perl::Critic violations. DESCRIPTION
This class accumulates statistics on Perl::Critic violations across one or more files. NOTE: This class is experimental and subject to change. INTERFACE SUPPORT
This is considered to be a non-public class. Its interface is subject to change without notice. METHODS
"new()" Create a new instance of Perl::Critic::Statistics. No arguments are supported at this time. " accumulate( $doc, @violations ) " Accumulates statistics about the $doc and the @violations that were found. "modules()" The number of chunks of code (usually files) that have been analyzed. "subs()" The total number of subroutines analyzed by this Critic. "statements()" The total number of statements analyzed by this Critic. "lines()" The total number of lines of code analyzed by this Critic. "lines_of_blank()" The total number of blank lines analyzed by this Critic. This includes only blank lines in code, not POD or data. "lines_of_comment()" The total number of comment lines analyzed by this Critic. This includes only lines whose first non-whitespace character is "#". "lines_of_data()" The total number of lines of data section analyzed by this Critic, not counting the "__END__" or "__DATA__" line. POD in a data section is counted as POD, not data. "lines_of_perl()" The total number of lines of Perl code analyzed by this Critic. Perl appearing in the data section is not counted. "lines_of_pod()" The total number of lines of POD analyzed by this Critic. Pod occurring in a data section is counted as POD, not as data. "violations_by_severity()" The number of violations of each severity found by this Critic as a reference to a hash keyed by severity. "violations_by_policy()" The number of violations of each policy found by this Critic as a reference to a hash keyed by full policy name. "total_violations()" The the total number of violations found by this Critic. "statements_other_than_subs()" The total number of statements minus the number of subroutines. Useful because a subroutine is considered a statement by PPI. "average_sub_mccabe()" The average McCabe score of all scanned subroutines. "violations_per_file()" The total violations divided by the number of modules. "violations_per_statement()" The total violations divided by the number statements minus subroutines. "violations_per_line_of_code()" The total violations divided by the lines of code. AUTHOR
Elliot Shank "<perl@galumph.com>" COPYRIGHT
Copyright (c) 2007-2011 Elliot Shank. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.16.3 2014-06-09 Perl::Critic::Statistics(3)
All times are GMT -4. The time now is 03:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy