Need ls to show number of lines in each file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need ls to show number of lines in each file
# 1  
Old 11-19-2004
Need ls to show number of lines in each file

Hi,
I need a command that would let ls show number of lines in each file rather than file size in KBs.

I tried using wc -l as a source of input to ls but I found a problem cutting the file name since wc generates a space delimited list.

Any suggestions?

Thanks.

GmMike.
# 2  
Old 11-19-2004
"wc -l *" will give a list of filenames in the current directory preceeded by the number of lines, plus a total at the bottom.

Cheers
ZB
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Grep command to show the number of results

Hi I wanted to know if there is an option in grep command to show the number of results (not the number of lines of findings). Thanks (14 Replies)
Discussion started by: abdossamad2003
14 Replies

2. Shell Programming and Scripting

Number of Lines in a file

Hi All, This is my Scenario: I wanted to check if a particular name or pattern is present in a file based of that rest of the program should proceed. I want to print '0' if no matching found. v_File_Count=`grep -i "$v_Name_Pattern" $File_Path/Master_File_List.txt | wc -l` The above command... (5 Replies)
Discussion started by: TechGyaann
5 Replies

3. Shell Programming and Scripting

Show difference between two number

Hi, I would like to show the difference between two numbers. For example. input.txt 1 7 2 10 0 0 6 7 I would like a third field showing the difference between the numbers as below: ouput.txt 1 7 6 2 10 8 0 0 0 6 7 1 How do I do this? (4 Replies)
Discussion started by: general_lee
4 Replies

4. Shell Programming and Scripting

Grep into a file + show following lines

Hi guys, This is probably very easy but I've no idea how to pull this out. Basically, I need to find errors into a very large logfile. When you grep the ID, the output is like this: +- Type: 799911 Code: Ret: 22728954 Mand: X Def: Des: UserDes: SeqNo: 2 +- Type: 799911 Code: Ret:... (5 Replies)
Discussion started by: Arkadia
5 Replies

5. Shell Programming and Scripting

Number of lines in file

How can I find the number of lines in a file excluding lines starting with #? (4 Replies)
Discussion started by: kristinu
4 Replies

6. Shell Programming and Scripting

sed show lines text between 2 blank lines

I have a file like blah blah blah blah this is the text I need, which might be between 1-4 lines, but always has a blank line above and below it, and is at the end of the text file the code tags don't show the trailing blank line. I started by deleting the last blank line with: ... (2 Replies)
Discussion started by: unclecameron
2 Replies

7. Shell Programming and Scripting

Number lines of file and assign variable to each number

I have a file with a list of config files numbered on the lefthand side 1-300. I need to have bash read each lines number and assign it to a variable so it can be chosen by the user called by the script later. Ex. 1 some data 2 something else 3 more stuff which number do you... (1 Reply)
Discussion started by: glev2005
1 Replies

8. AIX

Show number of SSH connections

I'm investigating an issue where rsync's to an AIX server will sometimes fail. I suspect the problem might be due to the number of simultaneous SSH connections being made to the host dropping the rsync attempts. I'd like to view the number of open ssh connections. The who command will list logged... (1 Reply)
Discussion started by: indiana_tas
1 Replies

9. Shell Programming and Scripting

Show result only if number is greater then

Hello all Im trying to write one liner that will show me results only if the result of the expression is greater then 0 For example: I do : find . -name "*.dsp" | xargs grep -c SecurityHandler the result are : ./foo/blah/a.dsp:0 ./foo/blah1/b.dsp:1 ./foo/blah2/c.dsp:2... (1 Reply)
Discussion started by: umen
1 Replies

10. UNIX for Dummies Questions & Answers

Making Emacs to show line number

Hi all How can I make Emacs to show the line numbers at the left or right as a default. This might help me to quickly jump to a given line. Thanks SS (9 Replies)
Discussion started by: saurya_s
9 Replies
Login or Register to Ask a Question