Sponsored Content
Top Forums Shell Programming and Scripting Count field frequency in a '|' delimited file Post 302302871 by Franklin52 on Wednesday 1st of April 2009 08:15:39 AM
Old 04-01-2009
Code:
awk -F "|" '{print "Line no: "NR " has " NF " fields"}' file

Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

insert a field into a tab delimited file

Hello, Can someone help me to do this with awk or sed? I have a file with multiple lines, each line has many fields separated with a tab. I would like to add one more field holding 'na' in between the first and second fields. old file looks like, 1, field1 field2 field3 ... 2, field1... (7 Replies)
Discussion started by: ssshen
7 Replies

2. UNIX for Dummies Questions & Answers

Insert Field into a tab-delimited file

Hello, I have about 100 files in a directory with fields which are tab delimited. I would like to append the file name as the first field and it has to be done as many times as the total lines in the file. For example, myFile1.txt has the following data: 1 x y z 2 a b ... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies

3. Shell Programming and Scripting

count of null in pipe delimited txt file

Hi, I have a pipe delimited txt file which contains 17 fields per line/row. 16th field contains email id. I want to count the number of lines/rows that contains null in the 16th field. Plz find attached example data file. I'm looking for a command line/script which achieves this. ... (5 Replies)
Discussion started by: Sriranga
5 Replies

4. Shell Programming and Scripting

Pad zeroes first field in a Delimited file

Need help. I tried using an awk command to pad zeroes. Unfortunately, the "|" pipe delimited character is gone when I tried to write the records to another file. awk -F \| ' {$1=sprintf("%06s", $1); print $0}' $CUSTFINAL2 > $CUSTFINAL3 BEFORE "KEYRECORD"|"SA ID"|"PER ID"|"SP ID"|"ACCT... (3 Replies)
Discussion started by: johnhips
3 Replies

5. Shell Programming and Scripting

Count number of column in a comma delimited file

I have a comma (,) delimited file. 106232145,"medicare","medicare,medicaid",789 I would like to count the number of fields in each line. I tried the below code awk -F ',' '{print NF-1}' This returns me the result as 5 instead of 4. This is because the awk takes... (9 Replies)
Discussion started by: machomaddy
9 Replies

6. Shell Programming and Scripting

Extract a nth field from a comma delimited file

Hi, In my file (which is "," delimited and text qualifier is "), I have to extract a particualr field. file1: 1,"aa,b",4 expected is the 2nd field: aa,b I tried the basic cut -d "," -f 2 file 1, this gave me aa alone instead aa,b. A small hint ot help on this will be very... (5 Replies)
Discussion started by: machomaddy
5 Replies

7. UNIX for Dummies Questions & Answers

add new 'date field' in a pipe delimited file

i need to add a new field in a pipe delimited line. the field will be the current date today. aa|a|s|w|1 as|oiy|oiy|oiy|2 given that all lines are uniformed in the number of fields i want it to look like this:\ aa|a|s|w|1|20120126 as|oiy|oiy|oiy|2|20120126 please help :) (3 Replies)
Discussion started by: kokoro
3 Replies

8. Shell Programming and Scripting

count frequency of words in a file

I need to write a shell script "cmn" that, given an integer k, print the k most common words in descending order of frequency. Example Usage: user@ubuntu:/$ cmn 4 < example.txt :b: (3 Replies)
Discussion started by: mohit_iitk
3 Replies

9. Shell Programming and Scripting

Remove Last field from a delimited file

Hi, I have a '~' delimited file and i want to remove the last field using awk. Please find the sample records below: 1428128~1~0~1100426~003~50220~005~14~0~194801~11~0~3~14~0~50419052335~0~0820652001~2~00653862 ~0~1~0~00126~1~20000110~20110423~R~ ~0~Z~1662.94~ ~002041~0045~Z~... (3 Replies)
Discussion started by: Arun Mishra
3 Replies

10. Shell Programming and Scripting

Replace field in the delimited file

Hi, I have the requirement similar to the one mentioned in the below thread. https://www.unix.com/unix-for-dummies-questions-and-answers/128155-search-replace-string-only-particular-column-delimited-file.html The only difference is that I need to change the field for row 1,2 and the last... (14 Replies)
Discussion started by: chetanojha
14 Replies
mlib_SignalMelCepstralInit_S16(3MLIB)			    mediaLib Library Functions			     mlib_SignalMelCepstralInit_S16(3MLIB)

NAME
mlib_SignalMelCepstralInit_S16, mlib_SignalMelCepstralInit_F32 - initialization for cepstral analysis in mel frequency scale SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_SignalMelCepstralInit_S16(void *state, mlib_s32 nlinear, mlib_s32 nmel, mlib_f32 melbgn, mlib_f32 melend, mlib_f32 meldiv, mlib_s32 order); mlib_status mlib_SignalMelCepstralInit_F32(void *state, mlib_s32 nlinear, mlib_s32 nmel, mlib_f32 melbgn, mlib_f32 melend, mlib_f32 meldiv, mlib_s32 order); DESCRIPTION
Each of these functions initializes the internal state structure for cepstral analysis in mel frequency scale. The init function performs internal state structure allocation and global initialization. Per function call initialization is done in each function, so the same internal state structure can be reused for multiplefunction calls. PARAMETERS
Each of the functions takes the following arguments: state Pointer to the internal state structure. nlinear The number of band pass filters in linear frequency scale. nmel The number of band pass filters in mel frequency scale. melbgn The begin radian frequency of the mel scale filter bank defined in linear frequency scale, where 0 <= melbgn < melend <= PI, melbgn is ignored if nlinear = 0. melend The end radian frequency of the mel scale filter bank defined in linear frequency scale, where 0 <= melbgn < melend <= PI. meldiv The dividing factor in linear to mel scale conversion, linear scale is measured in radians, with PI corresponding to half the sampling rate. order The order of the input signal vector and the cepstral coefficients, where length = 2**order. RETURN VALUES
Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_SignalMelCepstral_S16(3MLIB), mlib_SignalMelCepstral_F32(3MLIB), mlib_SignalMelCepstral_S16_Adp(3MLIB), mlib_SignalMelCepstral- Free_S16(3MLIB), mlib_SignalMelCepstralFree_F32(3MLIB), attributes(5) SunOS 5.10 9 Nov 2004 mlib_SignalMelCepstralInit_S16(3MLIB)
All times are GMT -4. The time now is 07:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy