Sponsored Content
Top Forums UNIX for Dummies Questions & Answers count number of fields not using SED or AWK Post 302336953 by strasner on Thursday 23rd of July 2009 07:17:02 AM
Old 07-23-2009
count number of fields not using SED or AWK

hi forums

i need help with a little problem i am having.

i need to count the number of fields that are in a saved variable so i can use that number to make a different function work properly.

is there a way of doing this without using SED/AWK?

anything would be greatly appreciated
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How count number of fields in a record

Dear All , I have the query cat temp.txt |28-07-1997|IF_LEG_DCCT|TOV JV sdfsdfdsfdsfdsCLOSED* KIEV|381015280 I need to count the number of fields in this pipe-seperated file. I beleive this is possible via AWK command. The in above file, output of the count should be 5.... Can some-one... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

2. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

3. Shell Programming and Scripting

Count the number of fields in column

Hi I was going through the below thread https://www.unix.com/shell-programming-scripting/48535-how-count-number-fields-record.html I too have something similar requirement as specified in this thread but the number of columns in my case can be very high, so I am getting following error. ... (3 Replies)
Discussion started by: shekharjchandra
3 Replies

4. Shell Programming and Scripting

count and number instances of a character in sed or awk

I currently use LaTeX together with a sed script to set cloze test papers for my students. I currently pepend and equals sign to the front of the words I want to leave out in the finished test, =perpendicular, for example. I am able to number the blanks using a variable in LaTeX. I would like to... (8 Replies)
Discussion started by: maouinin
8 Replies

5. Shell Programming and Scripting

awk - count character count of fields

Hello All, I got a requirement when I was working with a file. Say the file has unloads of data from a table in the form 1|121|asda|434|thesi|2012|05|24| 1|343|unit|09|best|2012|11|5| I was put into a scenario where I need the field count in all the lines in that file. It was simply... (6 Replies)
Discussion started by: PikK45
6 Replies

6. Shell Programming and Scripting

awk count fields not working

Hi, i am trying to count the fields in a file. Input: 100,1000,,2000,3000,10/26/2012 12:12:30 200,3000,,1000,01/28/2012 17:12:30 300,5000,,5000,7000,09/06/2012 16:12:30 output: Cout of the fileds for each row 6 5 6 awk -F"," '{print $NF}' file1.txt When i try with above awk... (3 Replies)
Discussion started by: onesuri
3 Replies

7. Shell Programming and Scripting

awk to count and rename based on fields

In the below awk using the tab-delimited input, I am trying count the - symbol in $5 and output the count as well as the renamed condition ins. I am also count the - symbol in $6 and output the count as well as the renamed condition del. I am also count the tomes that in $5 and $6 there are... (6 Replies)
Discussion started by: cmccabe
6 Replies

8. Shell Programming and Scripting

awk to output match and mismatch with count using specific fields

In the below awk I am trying output to one file those lines that match between $2,$3,$4 of file1 and file2 with the count in (). I am also trying to output those lines that are missing between $2,$3,$4 of file1 and file2 with the count of in () each. Both input files are tab-delimited, but the... (7 Replies)
Discussion started by: cmccabe
7 Replies

9. Shell Programming and Scripting

awk to remove lines where field count is greather than 1 in two fields

I am trying to remove all the lines and spaces where the count in $4 or $5 is greater than 1 (more than 1 letter). The file and the output are tab-delimited. Thank you :). file X 5811530 . G C NLGN4X 17 10544696 . GA G MYH3 9 96439004 . C ... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. UNIX for Beginners Questions & Answers

awk or sed script to count number of occurrences and creating an average

Hi Friends , I am having one problem as stated file . Having an input CSV file as shown in the code U_TOP_LOGIC/U_HPB2/U_HBRIDGE2/i_core/i_paddr_reg_2_/Q,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0... (4 Replies)
Discussion started by: kshitij
4 Replies
pppstats(8)						      System Manager's Manual						       pppstats(8)

NAME
pppstats - Print Point-to-Point Protocol (PPP) statistics SYNOPSIS
/usr/sbin/pppstats [-a] [-v] [-r] [-c count] [-w secs] [interface] [-z] OPTIONS
Displays absolute values rather than deltas. With this option, all reports show statistics for the time since the link was initiated. Without this option, the second and subsequent reports show statistics for the time since the last report. Repeats the display count times. The default repeat count is 1 if the -w option is not specified, otherwise infinity. Displays the overall packet compression rate. The rate value is between 0 and 1, with 0 meaning that the data is incompressible. Displays additional statistics, such as the number of packets ignored (rejected by the VJ TCP header decompression code). Pauses wait seconds between each display. If this option is not spec- ified, the default interval is 5 seconds. Instead of the standard display, show statistics indicating the performance of the packet com- pression algorithm in use. See the STATISTICS section for further information on this option. DESCRIPTION
The pppstats utility reports PPP-related statistics at regular intervals for the specified PPP interface. If interface is unspecified, it will default to ppp0. The display is split horizontally into input and output sections containing columns of statistics describing the properties and volume of packets received and transmitted by the interface. STATISTICS The following fields are printed on the input side when the -z option is not used: The total number of bytes received by this interface. The total number of packets received by this interface. The number of header-compressed TCP packets received by this interface. The num- ber of header-uncompressed TCP packets received by this interface. Not reported when the -r option is specified. The number of corrupted or bogus header-compressed TCP packets received by this interface. Not reported when the -r option is specified. The number of VJ header- compressed TCP packets dropped on reception by this interface because of preceding errors. Only reported when the -v option is specified. The total number of non-TCP packets received by this interface. Only reported when the -v option is specified. The compression ratio achieved for received packets by the packet compression scheme in use, defined as the uncompressed size divided by the compressed size. Only reported when the -r option is specified. The total number of bytes received, after decompression of compressed packets. Only reported when the -r option is specified. The following fields are printed on the output side: The total number of bytes transmitted from this interface. The total number of pack- ets transmitted from this interface. The number of TCP packets transmitted from this interface with VJ-compressed TCP headers. The number of TCP packets transmitted from this interface with VJ-uncompressed TCP headers. Not reported when the -r option is specified. The total number of non-TCP packets transmitted from this interface. Not reported when the -r option is specified. The number of searches for the cached header entry for a VJ header compressed TCP packet. Only reported when the -v option is specified. The number of failed searches for the cached header entry for a VJ header compressed TCP packet. Only reported when the -v option is specified. The compression ratio achieved for transmitted packets by the packet compression scheme in use, defined as the size before compression divided by the compressed size. Only reported when the -r option is specified. The total number of bytes to be transmitted, before packet compression is applied. Only reported when the -r option is specified. When the -z option is specified, pppstats displays the following fields, relating to the packet compression algorithm currently in use. If packet compression is not in use, these fields all display zeroes. The fields displayed on the input side are: The number of bytes of com- pressed packets received. The number of compressed packets received. The number of bytes of incompressible packets (that is, those which were transmitted in uncompressed form) received. The number of incompressible packets received. The recent compression ratio for incoming packets, defined as the uncompressed size divided by the compressed size (including both compressible and incompressible packets). The fields displayed on the output side are: The number of bytes of compressed packets transmitted. The number of compressed packets transmitted. The number of bytes of incompressible packets transmitted (that is, those which were transmitted in uncompressed form). The number of incompressible packets transmitted. The recent compression ratio for outgoing packets. SEE ALSO
Daemons: pppd(8) pppstats(8)
All times are GMT -4. The time now is 07:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy