Sponsored Content
Top Forums Shell Programming and Scripting Printing Number of Fields with the line number Post 302591910 by bartus11 on Saturday 21st of January 2012 01:56:27 PM
Old 01-21-2012
Code:
awk -F '|' '{print NR,NF}'

This User Gave Thanks to bartus11 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

printing a line number using awk

Hi Chaps, I'm trying to print the line number of a comma delimited file where the second field in the line is blank using AWK. Here is the code I have so far where am I going wrong. It is the last column in the file. nawk -v x==0 'BEGIN {FS=",";OFS=","} x++ if ($2 == " ") print $x' bob.tst ... (3 Replies)
Discussion started by: rjsha1
3 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

printing line number

hi, i have a file, i need to search for a string , if the line contains i need to print that line number and line , please help thanks in advance Satya (5 Replies)
Discussion started by: Satyak
5 Replies

4. Shell Programming and Scripting

regarding about printing line number

Hello, I am testing some data to get line number at cursor position 9 and found some problem, the code is below.Assume we got 3 attribute. At second attribute, there are some data(eg.A41/A6) missing like at the fourth and six line 11006 A41 1888 11006 ... (7 Replies)
Discussion started by: davidkhan
7 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

Printing the line number in bash script

Hi, I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened. Thanks, (6 Replies)
Discussion started by: suryaemlinux
6 Replies

7. Shell Programming and Scripting

print the number of fields in each line

I am looking for equivalent of following awk command in perl # awk '{ print NF ":" $0 } ' junk1 8:VAH NIC_TYPE CONFIG SIZE_GB PILO KOM BHA_GRP DESCR 8:2 NIC6 cont 34 y n shal_orgrp /shal 8:4 NIC5 signa 52 n y shal_orgrp... (3 Replies)
Discussion started by: dynamax
3 Replies

8. Shell Programming and Scripting

Printing the line number of first column found

Hello, I have a question on how to find the line number of the first column that contains specific data. I know how to print all the line numbers of those columns, but haven't been able to figure out how to print only the first one that is found. For example, if my data has four columns: 115... (3 Replies)
Discussion started by: user553
3 Replies

9. Shell Programming and Scripting

awk to find number in a field then print the line and the number

Hi I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field. The source file is pipe delimited and looks something like 1|net|ABC Letr1|1530||| 1|net|EXP_1040 ABC|1121||| 1|net|EXP_TG1224|1122||| 1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies

10. Shell Programming and Scripting

Print line if values in fields matches number and text

datafile: 2017-03-24 10:26:22.098566|5|'No Route for Sndr:RETEK RMS 00040 /ZZ Appl:PF Func:PD Txn:832 Group Cntr:None ISA CntlNr:None Ver:003050 '|'2'|'PFI'|'-'|'EAI_ED_DeleteAll'|'EAI_ED'|NULL|NULL|NULL|139050594|ActivityLog| 2017-03-27 02:50:02.028706|5|'No Route for... (7 Replies)
Discussion started by: SkySmart
7 Replies
Module::CoreList::Utils(3pm)				 Perl Programmers Reference Guide			      Module::CoreList::Utils(3pm)

NAME
Module::CoreList::Utils - what utilities shipped with versions of perl SYNOPSIS
use Module::CoreList::Utils; print $Module::CoreList::Utils::utilities{5.009003}{ptar}; # prints 1 print Module::CoreList::Utils->first_release('corelist'); # prints 5.008009 print Module::CoreList::Utils->first_release_by_date('corelist'); # prints 5.009002 DESCRIPTION
Module::CoreList::Utils provides information on which core and dual-life utilities shipped with each version of perl. It provides a number of mechanisms for querying this information. There is a functional programming API available for programmers to query information. Programmers may also query the contained hash structure to find relevant information. FUNCTIONS API
These are the functions that are available, they may either be called as functions or class methods: Module::CoreList::Utils::first_release('corelist'); # as a function Module::CoreList::Utils->first_release('corelist'); # class method "utilities" Requires a perl version as an argument, returns a list of utilities that shipped with that version of perl, or undef/empty list if that perl doesn't exist. "first_release( UTILITY )" Requires a UTILITY name as an argument, returns the perl version when that utility first appeared in core as ordered by perl version number or undef ( in scalar context ) or an empty list ( in list context ) if that utility is not in core. "first_release_by_date( UTILITY )" Requires a UTILITY name as an argument, returns the perl version when that utility first appeared in core as ordered by release date or undef ( in scalar context ) or an empty list ( in list context ) if that utility is not in core. "removed_from( UTILITY )" Takes a UTILITY name as an argument, returns the first perl version where that utility was removed from core. Returns undef if the given utility was never in core or remains in core. "removed_from_by_date( UTILITY )" Takes a UTILITY name as an argument, returns the first perl version by release date where that utility was removed from core. Returns undef if the given utility was never in core or remains in core. DATA STRUCTURES
These are the hash data structures that are available: %Module::CoreList::Utils::utilities A hash of hashes that is keyed on perl version as indicated in $]. The second level hash is utility / defined pairs. AUTHOR
Chris "BinGOs" Williams <chris@bingosnet.co.uk> Currently maintained by the perl 5 porters <perl5-porters@perl.org>. This module is the result of archaeology undertaken during QA Hackathon in Lancaster, April 2013. LICENSE
Copyright (C) 2013 Chris Williams. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
corelist, Module::CoreList, perl, <http://perlpunks.de/corelist> perl v5.18.2 2014-01-06 Module::CoreList::Utils(3pm)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy