Sponsored Content
Full Discussion: count fields
Top Forums UNIX for Dummies Questions & Answers count fields Post 11559 by Jimbo on Friday 7th of December 2001 11:40:49 AM
Old 12-07-2001
As clarification, the sed solution, as coded, will drop the last two characters of each line that ends with two characters:
first character must be space, letter or digit
second character can be anything
otherwise will leave the line unchanged.
Jimbo
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help me to count no of fields in a file

hi i am a new unix user i want to check whether a file contains spacefied no of fields if so i should delete last fields and then insert some fields in 2nd field please help me Thanks Regards babu :mad: (7 Replies)
Discussion started by: babu@shell
7 Replies

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

3. Shell Programming and Scripting

Get count on different fields along the raws in a file

Dear All, Please help me to do this. I have a file like this. 5|94662240807|94776109911|94776325901|94779007172|||||| 5|94112925421|94352240384|94352259199|94672229012|||||| 5|94714242745|94722952461|94777660793|94788914465|||||| 5|94242224624|94776145420|94776172499|94776531059|||||| ... (7 Replies)
Discussion started by: Nayanajith
7 Replies

4. Shell Programming and Scripting

To count distinct fields in a row

I have . dat file which contains data in a specific format: 0 3 892 921 342 1 3 921 342 543 2 4 817 562 718 765 3 3 819 562 717 761 i need to compare each field in a row with another field of the same column but different row and cont the... (8 Replies)
Discussion started by: Abhik
8 Replies

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

6. UNIX for Dummies Questions & Answers

Count Fields with Quoted Field

Hi, I used to count number of fields using following command head -1 <filename> | awk -F"," '{print NF}' Now the scenario is the delimiter(comma) occurs inside one of the data field. How to ignore the comma inside data and consider only delimiter and count number of fields. The fields are... (1 Reply)
Discussion started by: ethanr100
1 Replies

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

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

9. Shell Programming and Scripting

Count blank fields in every line

Hello All, I am trying a one liner for finding the number of null columns in every line of my flat file. The format of my flat file is like this a|b|c|d||||e|f|g| a|b|c|d||||e|f|g| I want to count the number of fields delimited by "|" which are blank. In above case the count should be... (6 Replies)
Discussion started by: nnani
6 Replies

10. Shell Programming and Scripting

How To Count Fields For Cut?

I am new to cut and I want to use the field option with a space delimiter on an Apache log file. For example, if I wanted to find the 200 HTTP code using cut in this manner on the file below cat access_abc.log | cut -d' ' -f7 | grep "200" 157.55.39.183 - - "GET /content/696-news041305... (4 Replies)
Discussion started by: sharingsunshine
4 Replies
ctype(3C)																 ctype(3C)

NAME
ctype: isalnum(), isalpha(), isascii(), isblank(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit() - classify characters according to type SYNOPSIS
DESCRIPTION
These functions classify character-coded integer values according to the rules of the coded character set identified by the last successful call to (see setlocale(3C)). Each function is a predicate returning nonzero for true, zero for false. If has not been called successfully, characters are classified according to the rules of the default ASCII 7-bit coded character set (see setlocale(3C)). is defined on all integer values; the other functions are defined for the range (EOF) through RETURN VALUE
The functions return nonzero under the following circumstances; zero otherwise: c is an alphanumeric (letters or digits). c is a letter. c is any ASCII character code between 0 and 0177, inclusive. c is a blank character; that is, a space or a tab. c is a control character (in ASCII: character codes less than 040 and the delete character(0177)). c is a decimal digit (in ASCII: characters [0-9]). c is a visible character (in ASCII: printing characters, excluding the space character(040)). c is a lowercase letter. c is a printing character. c is a punctuation character (in ASCII: any printing character except the space character(040), digits, letters). c is a character that creates whitespace in displayed text (in ASCII: space, tab, carriage return, newline, verti- cal tab, and formfeed). c is an uppercase letter. c is a hexadecimal digit (in ASCII: characters [0-9], [A-F] or [a-f]). If the argument to any of these functions is outside the domain of the function, the result is undefined. EXTERNAL INFLUENCES
Environment Variables The category determines the classification of character type. International Code Set Support Single-byte character code sets are supported. WARNINGS
These functions are supplied both as library functions and as macros defined in the header. Normally, the macro versions are used. To obtain the library function, either use a to remove the macro definition or, if compiling in ANSI-C mode, enclose the function name in parenthesis or take its address. The following example uses the library functions for and AUTHOR
was developed by IBM, OSF, and HP. SEE ALSO
setlocale(3C), ascii(5), thread_safety(5). STANDARDS CONFORMANCE
ctype(3C)
All times are GMT -4. The time now is 01:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy