Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-06-2004, 08:16 PM   #1
LQ Newbie
Registered: Feb 2004
Distribution: Mandrake
Posts: 7

Rep: Reputation: 0
Length of filenames

I want to know how to be able to search through a directory and print out just the file that has the longest filename. Like i am writing scripts for it

If anyone just knows a way to find the length of a filename i would be happy

Old 05-06-2004, 10:15 PM   #2
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
Because I'm lazy, here's a start for this:

for i in `ls`;do echo $i |wc -c;done

I leave it to the poster to figure out the eval statements and what not.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Password length ust Linux - Distributions 1 04-06-2005 06:18 AM
Shell scripting to find length of filenames ridertech Linux - Newbie 2 08-25-2004 01:07 PM
sound length mihman Linux - Software 0 08-21-2003 06:21 AM
Horizontal Length rch LQ Suggestions & Feedback 1 05-16-2003 04:21 AM
message length boku LQ Suggestions & Feedback 2 08-05-2002 12:57 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration