count filename characters

count filename characters

Post by hak » Mon, 13 Sep 2004 00:11:19



hi,
i want to search all the .abc file first and then count the characters
of filename. how to use wc..any suggestions

thanks in advance

--
hak
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

 
 
 

count filename characters

Post by Christopher W Aike » Mon, 13 Sep 2004 06:24:01


On Sat, 11 Sep 2004 11:11:19 -0400, hak wrote

Quote:

> hi,
> i want to search all the .abc file first and then count the characters
> of filename. how to use wc..any suggestions

> thanks in advance

> --
> hak
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------

#!/bin/tcsh

set files=`*.abc`
foreach i ($files)
   set j=`echo $i | wc -c`
   echo "File: $i   numchrs: $j"
end
set j=`echo $files | wc -c`
echo "Total chars: $j"
exit

--
-=[cwa]=-
chris at cwaiken dot net

 
 
 

count filename characters

Post by rakesh shar » Tue, 21 Sep 2004 03:30:43



> i want to search all the .abc file first and then count the characters
> of filename. how to use wc..any suggestions

for file in ./*.abc ./.*.abc; do
 [ -f "$file" ] || continue
 printf 'Filename %s --> Characters --> ' "$file"
 expr "$file" : './\(.*\)' : '.*'
 echo ''
done
 
 
 

count filename characters

Post by Alan Conno » Tue, 21 Sep 2004 03:52:41



> hi, i want to search all the .abc file first and then count the
> characters of filename. how to use wc..any suggestions

> thanks in advance

> --
> OOO
> ------------------------------------------------------------------------
> OOOOOO OOO OOOO://OOO.OOOOOOOOOOOO.OOO
> ------------------------------------------------------------------------

Your sig needs to have a delimeter "-- " so that people
don't have to see your sig if they don't want to. Yours lacks
the space after the two dashes which means it can't be properly
interpreted by people's newsreaders.

The limit is 4 lines, and that includes any blank ones.

And those lines are two long. Try 65 characters instead, which
is where they were trimmed.

Fix it up and I'll help you when I can.

If it's the server that's doing it, find another provider.

Don't, and I won't do anything but post this to you, again and
again, as I did the last time you were here.

AC

 
 
 

count filename characters

Post by Heiner Steve » Tue, 21 Sep 2004 04:22:09



> i want to search all the .abc file first and then count the characters
> of filename. how to use wc..any suggestions

for name in *.abc
do
     echo "$name" | wc -c
     # or
     expr "$name" : '.*'
     # or (ksh, bash):
     echo ${#name}
done

Heiner
--
  ___ _

\__ \  _/ -_) V / -_) ' \    Shell Script Programmers: visit
|___/\__\___|\_/\___|_||_|   http://www.shelldorado.com/

 
 
 

1. Script that counts counts the characters per line.

I have an ascii file that has one alpha/numeric word on each line.
The "word" is either 11 characters or 17 characters.  How can I read
the file line by line and count the characters of each line. What I'm
looking for is something like:
===================
read file.txt
for 1 to [# of lines in file.txt]
   X=count line[1,2,3,...EOF]
   if X=11
      a=a+1
   else if X=17
      b=b+1
   endif
next
===================
example file.txt:
12894574068
859473h5kf8
fhj49874363985830
38575938758
5648309747tu67584
12847364958747635
3896587463950f084
39578659679
===================

I'm doing this in POSIX shell.

Thanks for any pointers anyone can give me.

T.
p8oust7eh+

2. Programming in X (green guy)

3. count number of filenames

4. Determining interactive shell mode (BASH) ?

5. How to count a specified character in a file?

6. SuSE evaluation-6.1.iso crippled?

7. Counting characters in a variable

8. Disk striping

9. Input buffer character count

10. character count in ksh

11. Counting same character in a string.

12. counting character ?

13. count of character strings