![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What the command to find out the record length of a fixed length file? | tranq01 | UNIX for Dummies Questions & Answers | 9 | 12-04-2008 04:04 PM |
| Change All File Names in a Directory | andou | UNIX for Dummies Questions & Answers | 8 | 01-22-2008 09:06 PM |
| Replace characters in all file names in a particular directory | madhunk | Shell Programming and Scripting | 4 | 02-16-2006 07:10 PM |
| directory names in a flat file | surjyap | Shell Programming and Scripting | 2 | 10-06-2005 08:51 AM |
| File and Directory Names become hidden | dbinsol1 | UNIX for Advanced & Expert Users | 10 | 05-29-2002 10:58 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
find the length of file names in a directory?
Hi,
how can find length of file names in a directory. Examp: I have a directory with name "d1". directory: d1 files: aaa.log bbb.log abcd.log abcdef.log I wold like out put like: file name legnth aaa.log 3 bbb.log 3 abcd.log 4 abcdef.log 5 Thanks |
|
||||
|
Script to get file name length discarding dot extension
If I understand your question, the following should work or you can modify it to do what you need.
for i in `ls -1` do val=`echo $i | cut -d '.' -f1 | wc | tr '\t' ' ' | tr -s ' ' | sed 's/^ //' | cut -d' ' -f 3` val=`/usr/bin/expr $val - 1` echo $i $val done |
![]() |
| Bookmarks |
| Tags |
| awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|