Sponsored Content
Full Discussion: file count with a twist
Top Forums UNIX for Dummies Questions & Answers file count with a twist Post 302329910 by robert4732 on Monday 29th of June 2009 04:34:44 PM
Old 06-29-2009
file count with a twist

Hello Everyone,

I am using the korn shell.

I was hoping to find a set of commands to count files in a directory.

I am using:
ls /home/name/abc* | wc -l

This command works fine when a file matches abc* (returns only the file count) , however when no file(s) are found I get something similar to below:

/home/name/abc*: No such file or directory
0

I want only the 0 when a file is not found and not the path or message - 'No such file or directory' .

Can a single unix command accomplish this? Or does a script need to be written?

Thanks in advance.

Robert
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how do I log into this machine - with a twist...

I know this topic has been covered in one form or another, but it hasn't been covered to handle my problem. I was given a Sparc4 running Solaris 2.5.1 The root password is unknown. This machine has no cdrom drive and it has no floppy drive. I tried booting into the single user mode, but... (1 Reply)
Discussion started by: xyyz
1 Replies

2. UNIX for Dummies Questions & Answers

How to count the record count in an EBCDIC file.

How do I get the record count in an EBCDIC file on a Linux Box. :confused: (1 Reply)
Discussion started by: oracle8
1 Replies

3. Shell Programming and Scripting

Compare 2 files yet again but with a twist

Ok so I have a file which contains 2 columns/fields and I have another file with 2 columns. The files look like: file1: 1 33 5 345 18 2 45 1 78 31 file2: 1 c1d2t0 2 c1d3t0 3 c1d4t0 4 c1d4t0 5 c2d1t0 6 c2d1t0 7 c2d1t0 8 c2d1t0 9 c2d1t0 10 c2d1t0 (11 Replies)
Discussion started by: Autumn Tree
11 Replies

4. UNIX for Advanced & Expert Users

building a kernel (with a twist)

Hey all, I am working on a static analysis tool and I wan't to see if it can find bugs in the linux kernel, it uses LLVM framework to analyse the instructions. Long story short I need to build the kernel with a custom compiler. The compiler will create byte code files where binaries usually... (2 Replies)
Discussion started by: zigga15
2 Replies

5. Shell Programming and Scripting

Getting Sum, Count and Distinct Count of a file

Hi all this is a UNIX question. I have a large flat file with millions of records. col1|col2|col3 1|a|b 2|c|d 3|e|f 3|g|h footer**** I am supposed to calculate the sum of col1 1+2+3+3=9, count of col1 1,2,3,3=4, and distinct count of col1 1,2,3=c3 I would like it if you avoid... (4 Replies)
Discussion started by: singhabhijit
4 Replies

6. Shell Programming and Scripting

Incrementing with a twist - please help

I'm currently trying to write a ksh or csh script that would change the name of a file found in directories and attach to the name an incrementing three digit number. I know how to write a script that will go: 000, 001, 002, 003, etc The twist is I need more increments then allowed by a 3... (11 Replies)
Discussion started by: Rust
11 Replies

7. Shell Programming and Scripting

Simple two file compare with twist

I have file1 and file2 I lookup field3 from file2 in field1 of file1 and if there is a match, output field 2,3,5 from file2. I now want to add field2 of file1 in the output. I suspect what I have to do is read the entire line of file1 into a 2 dim array? pls help. here is my code: ... (9 Replies)
Discussion started by: jack.bauer
9 Replies

8. Shell Programming and Scripting

Multiple File renaming with a twist

Hi I can do simple file renaming but this task is slightly more troublesome Ive got a guy that gives me multiple .pdf filles in a directory named something like 3412345.pdf 4565465.pdf 8534534.pdf And he also gives me a html file which is tabled with which shows the filenames above... (2 Replies)
Discussion started by: messiah1
2 Replies

9. Shell Programming and Scripting

Simple two file compare with twist

I have file1 and file2 I lookup field3 from file2 in field1 of file1 and if there is a match, output field 2,3,5 from file2. I now want to add field2 of file1 in the output. I suspect what I have to do is read the entire line of file1 into a 2 dim array? pls help. (1 Reply)
Discussion started by: tmonk1
1 Replies

10. Shell Programming and Scripting

File Listing, with a Twist?

Greetings! I have a quick question which must be deferred to those with greater skill than myself :) In this situation, I wish to create a list of all the files on an entire partition in descending order sorted by date. I tried numerous switches for ls, and found this line to be the closest... (4 Replies)
Discussion started by: LinQ
4 Replies
list clearinghouse(1m)													    list clearinghouse(1m)

NAME
list clearinghouse - Displays a list of all the clearinghouses whose names match the specified clearinghouse name SYNOPSIS
cdscp list clearinghouse clearinghouse-name [with attribute-name = attribute-value] ARGUMENTS
The full name of a specific clearinghouse. The last simple name can contain wildcard characters. The name of a particular attribute. The value of a particular attribute. DESCRIPTION
The list clearinghouse command displays a list of all the clearinghouses whose names match the specified name. The last simple name can contain wildcards. You can use a with attribute-name = attribute-value clause to limit output only to clearinghouses whose attributes have values equal to the specified values. A space must precede and follow the = (equals sign). Privilege Required You must have read permission to the directory that stores the associated clearinghouse object entry. If you use a with attribute-name = attribute-value clause in the command, you also need read or test permission to the selected clearinghouses. NOTE
This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE. EXAMPLE
The following command displays a list of all the clearinghouses named in the root directory: cdscp> list clearinghouse /.:/* LIST CLEARINGHOUSE /.../abc.com/* AT 1991-10-15-15:56:00 /.../abc.com/Munich_CH /.../abc.com/Paris_CH RELATED INFORMATION
Commands: clear clearinghouse(1m), create clearinghouse(1m), delete clearinghouse(1m), set cdscp preferred clearinghouse(1m), show cdscp preferred clearinghouse(1m), show clearinghouse(1m) list clearinghouse(1m)
All times are GMT -4. The time now is 02:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy