10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to figure out how many times a location (columns 1 and 2) is present within a group of files. I figured using a combination of 'while read' and 'grep' I could count the number of instances but its not working for me.
cat file.txt | while read line
do
grep $line *08-new.txt | wc -l... (6 Replies)
Discussion started by: ncwxpanther
6 Replies
2. Shell Programming and Scripting
I need to make a shell script that accepts a directory input by the user. The program searches for the directory and finds if it exists or not. Then if it does exist, it outputs the number of files within that directory. Here's what I have so far.
result=
echo "Please input a directory:... (5 Replies)
Discussion started by: itech4814
5 Replies
3. Shell Programming and Scripting
I am trying to display the output of ls and also print the number of characters in EVERY file name. This is what I have so far:
#!/bin/sh
for x in `ls`; do
echo The number of characters in x | wc -m
done
Any help appreciated (1 Reply)
Discussion started by: LinuxNubBrah
1 Replies
4. UNIX for Dummies Questions & Answers
Help Needed !
Can we count number of folders of specific date in a directory, even if directory has folders of different dates.
Please reply as soon as possible. (1 Reply)
Discussion started by: vishal_215
1 Replies
5. UNIX for Advanced & Expert Users
Hi all,
Need some help counting files... :)
I'm trying to count the number of files in a given directory (and subdirectories) which reportedly contains "thousands" of files.
I'm using this:
ls -R | wc -l
However it's been an hour and looks like it's still running; there is no output... (18 Replies)
Discussion started by: verdepollo
18 Replies
6. Shell Programming and Scripting
Hi All,
I have written a script on this but it does not do the requisite job. My requirement is this:
1. I have two kinds of files each with different extensions. One set of files are *.dat (6000 unique DAT files all in one directory) and another set *.dic files (6000 unique DIC files in... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
7. Shell Programming and Scripting
Hello, I'm writing a script in sh in which the first command line argument is a directory. from that, i'm suppose to count the number of readable, writable, and executable items in the directory. I know using $1 represents the directory, and ls would display all the items in the directory, and that... (4 Replies)
Discussion started by: kratos22
4 Replies
8. Shell Programming and Scripting
hi all,
i'm trying to pass a count of files to a variable thru these set of codes:
sh_count=$(ls -1 fnd_upload_LV*.* |wc -l)
problem is if no files matches that, it will give an error "ls: fnd_upload_LV*.*: No such file or directory".
how do i avoid having the shell script show that... (2 Replies)
Discussion started by: adshocker
2 Replies
9. UNIX for Dummies Questions & Answers
I need to count the number of files which have a search string, but counting the file only once
if search string is found.
eg: File1: Please note that there are 2 occurances of "aaa"
aaa
bbb
ccc
aaa
File2: Please note that there are 3 occurances of "aaa"
aaa
bbb
ccc... (1 Reply)
Discussion started by: sudheshnaiyer
1 Replies
10. UNIX for Dummies Questions & Answers
Some simple questions from a simple man.
If i wanted to count the number of files contained within a directory, say /tmp would ls -l /tmp ¦ wc -l suffice and will it be accurate?
second one: How would i check the number of files with a certain string in the filename, in the same directory.
... (2 Replies)
Discussion started by: iamalex
2 Replies