Also, like I mentioned earlier. I'm very new to this. How did your code fix my issue?
Expanding on what Scrutinizer said...
When the wc utility is given one or more operands, it reads from the named file(s) and prints the number of complete lines in each file and the file's name(s). (If more than one operand is given, it also prints a total line at the end.)
When no operands are given, wc reads from standard input and only prints the number of complete lines it found.
If you don't mind reversing the order (# of lines before file name) and you don't mind the total line at the end, this should be much more efficient:
This User Gave Thanks to Don Cragun For This Post:
1. Is there a way to count the number of bytes of a variable?
example:
abc@yahoo.com is 13 bytes
2. Cut command only allows one byte for delimiter
example: cut -f1 -d'.'
delimited by period. Is there a way to have two or more characters in the delimiter field?
thanks in adavance.
:) (4 Replies)
Hi All,
Is there is a way to do this in a single unix command
I have unzipped some files into a directory ..
I want to check the count of the files in the directory and also i need to check whether the files is having read permision or not.. I know it can be done by a script isthere... (4 Replies)
Hi All,
I'm trying to count how many line in my *.txt file.
My *.txt file has 1937 lines.
The problem is : when I use wc -l command
the result is 1936.
Again, I did some test. I create a new file with 100 lines with text editor (Notepad ++, Ultra edit).
And when I count it again with wc... (2 Replies)
Hi,
I have a script which removes 2 header records and 1 trailer record in a list of files. The commands doing the actions are
sed '1,2d' $file > tempfile1.dat
sed '$d' < tempfile1.dat > $output.txt
Its working fine for all records except a file having size=1445509814 and number of... (2 Replies)
I have created a file "pat".This file contains the text "abcdefghi". Now i want to count the characters in this file "pat". I gave wc -c | pat and it returns me exact count "9". Now when i tried like "echo pat | wc -m" It returns '4'. as for as i understand this command "echo pat | wc -m" should... (7 Replies)
Hi,
I have small query and a understanding, could you please clarify the query and correct my understanding..?
I am very big log file If i need to take a count and contained lines for a particular pattern/word i am using the grep command twice like the below.
grep -c "OutOfMemoryException"... (4 Replies)
I have a file that I need to count the number of "Y"s in the file, but just the "Y"s that fall between certain columns. Like:
file1:
1234567890123456789012345
BBBBBBYBBBBYBBYBBYBBYBBB
I want to count the 'Y's between 17 and 21 = 2 "Y"s
Thanks (12 Replies)
Hi all,
I need to run a bunch of commands seperated by ; but then count the total lines of output. Pipes and redirection don't seem to be helping me. Anyone know how I can do this properly:
ls /usr/bin/nslookup ; ls /usr/sbin/lsof ; ls /sbin/ifconfig ; ls /usr/sbin/dmidecode ; ls... (2 Replies)
Hello Experts,
I have a log file that contains 4 different type of exception :
1- Exception
2- Fatal
3- Error
4- Exec
My requirement is to find count of each type of exception, i tried using combination of -E and -C but that doesn't seems to be working :
grep -ec 'Exception' -ec... (4 Replies)