Sponsored Content
Full Discussion: How to display and count
Top Forums Shell Programming and Scripting How to display and count Post 302292279 by chebarbudo on Friday 27th of February 2009 10:50:12 AM
Old 02-27-2009
Great job rrk001!
I think I'm not even gonna use two different variables.
I can write my script like this:
Code:
r=$(mysql -e "SELECT id, name FROM terminal WHERE name LIKE '%$v%'" | awk '{count=NR-1;id=$1} END{print count"-"id}')
echo "There are ${r%%-*} results. The last one is ${r##*-}."

I modified count=NR-1 so I don't count the header as a result.

Thanks radoulov as well. I just noticed your post. Working on it.

Last edited by chebarbudo; 02-27-2009 at 11:56 AM.. Reason: forgot to thank radoulov
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display the count of files

I am new to shell programming. Can anyone help me out with anyone of these? Display a count of the number of regular files, the number of symbolic links, the number of sub-directories, the number of block-special files, and the number of character-special files in the directory. I don't... (4 Replies)
Discussion started by: wayne1411
4 Replies

2. Shell Programming and Scripting

Read File and Display The Count of a particular field

Hi Mates, I require help in the following: I have the following file snmp.txt Wed Mar 2 16:02:39 SGT 2011 Class : mmTrapBladeS origin : 10.0.0.0 hostname : 10.0.0.2 msg : IBM Blade Alert: Calendar Index : 10.0.0.2-IBMBLADE Fri Mar 4 07:10:54 SGT 2011 Class : mmTrapBladeS... (2 Replies)
Discussion started by: dbashyam
2 Replies

3. UNIX for Dummies Questions & Answers

Single UNIX command to display users and to count them

Hello everyone, I am new to Unix and I am stuck with a problem. I need only a single command to display the output of who and then add the total number of users and display at the bottom of that output. Example-: (Expected output) sreyan@debian:~$ <command> sreyan tty7 ... (7 Replies)
Discussion started by: sreyan32
7 Replies

4. Shell Programming and Scripting

To search for a particular tag in xml and collate all similar tag values and display them count

I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help File: <xml><object1>house</object1><object2>child</object2>... (9 Replies)
Discussion started by: srkmish
9 Replies

5. Programming

SQL*PLUS How to display a count of 0

Hi, I have been frantically googling and checking some sqlplus forums, but can't find the correct syntax. Basically within sqlplus I want to do a count on a table and if the count is 0 it displays 0 instead of "no rows found". For eample: select count(*) from tableA where... (3 Replies)
Discussion started by: chris01010
3 Replies

6. Shell Programming and Scripting

Extract count of string in all files and display on date wise

Hi All, hope you all are doing well! I kindly ask you for shell scripting help, here is the description: I have huge number of files shown below on date wise, which contains different strings(numbers you can say) including 505001 and 602001. ... (14 Replies)
Discussion started by: VasuKukkapalli
14 Replies

7. Shell Programming and Scripting

Count the number of string occurrences to display 0 entries in output

Hello Friends, Can somebody assist an issue I am having? I have a separate file with a list of account ids XXX200B02Y01 XXX200B03Y01 XXX200B05Y01 XXX200B07Y01 XXX200B08Y01 I call the file, and run an egrep against a directory and logfiles AccountID=$(cat... (2 Replies)
Discussion started by: liketheshell
2 Replies

8. UNIX for Beginners Questions & Answers

How to find the count of IP addresses that belong to different subnets and display the count?

Hi, I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output Here is how my file looks like 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.3.1 1.1.3.2 1.1.3.3 1.1.3.4 So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies
DMTXREAD(1)						      General Commands Manual						       DMTXREAD(1)

NAME
dmtxquery - extract information from dmtxread output SYNOPSIS
dmtxquery PROPERTY [OPTION]... [FILE]... DESCRIPTION
dmtxquery extracts information from the XML output from dmtxread for individual or grouped barcode scan results. PROPERTY
barcode.count count of all barcodes found in image barcode.N.BPROP print BPROP property of Nth barcode message.count count of all messages found in image message.N.MPROP print MPROP property of Nth message message.N.barcode.count count of all barcodes in Nth message message.N.barcode.M Mth barcode of Nth message, print all message.N.barcode.M.BPROP Mth barcode of Nth message, print BPROP BPROP barcode properties: message message_number message_position matrix_size data_codewords error_codewords rotation data_regions_count interleaved_blocks MPROP message properties: message data_codeword error_codeword OPTIONS
-V, --version Print program version information. --help Display this help message and quit. STANDARDS
ISO/IEC 16022:2000 ANSI/AIM BC11 ISS BUGS
Email bug reports to mike@dragonflylogic.com AUTHOR
Copyright (C) 2008, 2009 Mike Laughton September 4, 2009 DMTXREAD(1)
All times are GMT -4. The time now is 07:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy