Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help with counting string elements Post 302511592 by pawannoel on Thursday 7th of April 2011 06:27:09 AM
Old 04-07-2011
@ctsgnb
Thank you !

@Bartus
Thanks a lot for the Perl version. Could you please explain the use of -F switch and // after that ?
Cheers Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting patterns in a shell string

Hello, I am writing a shell script and I need to find a way to count the number of whitespaces in a string. Eg: NAME="Bob Hope" I am looking for a way to count the number of whitespaces in this string. So a command that would take this string and return 1. Or take "First Middle Last"... (3 Replies)
Discussion started by: kevin80
3 Replies

2. Shell Programming and Scripting

Search array elements as file for a matching string

I would like to find a list of files in a directory less than 2 days old and put them into an array variable. And then search for each file in the array for a matching string say "Return-code= 0". If it matches, then display the array element with a message as "OK". Your help will be greatly... (1 Reply)
Discussion started by: mkbaral
1 Replies

3. Shell Programming and Scripting

Counting string of a variable

Hi, There is a variable f_name, it store some file names. Value of f_name=a.sql b.sql c.sql....... like this. want to count how many file name the var f_name stores. Without using loop is there any command to count that. (5 Replies)
Discussion started by: Dip
5 Replies

4. Shell Programming and Scripting

Array with String Elements

How can I get my array to understand the double-quotes I'm passing into it are to separate text strings and not part of an element? here's what I'm working with... db2 -v connect to foo db2 -x "select '\"' || stats_command || '\",' from db2law1.parallel_runstats where tabname = 'BAZ'" set... (4 Replies)
Discussion started by: djschmitt
4 Replies

5. Fedora

Help with controlling string elements

Hi All, I have a general difficulty in understanding how to control single elements within a string. An example, XYZ1234 ABCD5678 My expected output is : ABCD1234 XYZ5678 (swapping subset of string elements of choice) XYZ37 ACBD1214 (making calculations... (6 Replies)
Discussion started by: pawannoel
6 Replies

6. UNIX for Dummies Questions & Answers

Help with editing string elements

Hi All I have a question. I would like to edit some string characters by replacing with characters of choice located in another file. For example in sample file>S5_SK1.chr01 NNNNNNNNNNNNNNNNNNNCAGCATGCAATAAGGTGACATAGATATACCCACACACCACACCCTAACACTAACCCTAATCTAACCCTGGCCAACCTGTTT... (9 Replies)
Discussion started by: pawannoel
9 Replies

7. UNIX for Dummies Questions & Answers

counting occurrence of characters in a string

Hello, I have a string like this 0:1:2:0:2:2:4:0:0:0:-200:500...... what i want is to break down how many different characters are there and their count. For example for above string it should display 0 - 5 times 1 - 1 times 2 - 3 times 4 - 1 times . . . I am stuck in writing... (8 Replies)
Discussion started by: exit86
8 Replies

8. Shell Programming and Scripting

Counting Instances of a String with AWK

I have a list of URLs and I want to be able to count the number of instances of addresses ending in a certain TLD and output and sort it like so. 5 bdcc.com 48 zrtzr.com 49 rvo.com Input is as so ync.org sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu... (1 Reply)
Discussion started by: Pjstaab
1 Replies

9. Shell Programming and Scripting

Counting a string between 2 strings...

I have been working on this for a little while and have been unable to come to a solution. Any help would be appreciated. I am working on a UNIX workstation and have a 30-40 meg text file that I am working with. In my real file there is hundreds of Jobs. Example of input file; misc logging data... (1 Reply)
Discussion started by: ny_evan
1 Replies

10. Shell Programming and Scripting

Counting elements in each record

Hello, I have a file such as below: 0 0 . . 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 1I want to count the number of 0 and 1 in each line (. represents no data) and print them into two columns, that is:... (3 Replies)
Discussion started by: Homa
3 Replies
explain_acct_or_die(3)					     Library Functions Manual					    explain_acct_or_die(3)

NAME
explain_acct_or_die - switch process accounting on or off and report errors SYNOPSIS
#include <libexplain/acct.h> void explain_acct_or_die(const char *pathname); int explain_acct_on_error(const char *pathname)) DESCRIPTION
The explain_acct_or_die function is used to call the acct(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_acct(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_acct_on_error function is used to call the acct(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_acct(3) function, but still returns to the caller. pathname The pathname, exactly as to be passed to the acct(2) system call. RETURN VALUE
The explain_acct_or_die function only returns on success, see acct(2) for more information. On failure, prints an explanation and exits, it does not return. The explain_acct_on_error function always returns the value return by the wrapped acct(2) system call. EXAMPLE
The explain_acct_or_die function is intended to be used in a fashion similar to the following example: explain_acct_or_die(pathname); SEE ALSO
acct(2) switch process accounting on or off explain_acct(3) explain acct(2) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2009 Peter Miller explain_acct_or_die(3)
All times are GMT -4. The time now is 04:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy