General :: Difference Between 'grep "" * | Wc -l' And 'wc -l *' Total Count?
Oct 12, 2010I am trying to find the number of lines in a directory containing .h and .cpp files.When I type
Code:
grep "
" * | wc -l
[code]....
I am trying to find the number of lines in a directory containing .h and .cpp files.When I type
Code:
grep "
" * | wc -l
[code]....
I'm running a find. -name pattern to find some files, and I'd like to elegantly get the total number of lines in these files. How can I achieve that?
View 4 Replies View RelatedI need to write shell script which can take number of files and count total rows from all CSVs and display total number of rows counted in all files. Is there any possibility of doing that using shell script and if yes then how.
View 4 Replies View RelatedThis has to also show the line count. I can get it to show the files but not the line count. What is the single command used to identify only the matching count of all lines within files under the /etc directory that contain the word „HOST? List only the files with matches and suppress any error messages.
View 4 Replies View RelatedI am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files. File structure is same on both servers and for reference as follows:
Code:
27-Aug-2010 10:04:30,601|919122874903|phtunes_app|1282243292627|NotifySmsReception|DMGenerateLogInterceptor - ExternalTransactionID:SDP-DM-26713018, TransactionStatus:Requested
27-Aug-2010
[code]....
For searching a file or directory i normally use grep command. kindly can you guide me the difference between grep and find command. I have used both but that are the difference between them ? are the same or grep is new as comapird to find command.
View 2 Replies View RelatedI am trying to do a find/grep/wc command to find matching files, print the filename and then the word count of a specific pattern per file. Here is my best (non-working) attempt so far:
wc `find . ( -name "*.as" -o -name "*.mxml" ) -exec grep -H HeightResizableList {}` ;
I have the following perl/DBI script:
Quote:
#!/usr/bin/perl
use DBI;
my ($db, $user, $pw) = ('dbname', '****', '***********');
my $dbh = DBI->connect("DBI:mysql:$db",$user,$pw) or die "Cannot connect to $db: $DBI::errstr
[code].....
The error message is
[Wed Feb 24 13:03:27 2010] myscript.cgi: DBD::mysql::st execute failed: Column count doesn't match value count at row 1 at myscript.cgi. [Wed Feb 24 13:03:27 2010] myscript.cgi: DBI::db=HASH(0x8a30c60)->errstr
I need to kind of grep within grep. My input file would be something like:
[Code]....
and I need to find the first occurrence of hello before MY PATTERN (hello 9008 in this case), so the output should be:
[Code]....
I just got in trouble with my internet company because my daily upload is too much.
Is there a way I can limit the total upload from my pc? I'm using Gentoo.
Is there a way to do this in Linux?
I am analyzing memory usage on a Linux system. When I run vmstat -s, I see the following:
waffleman@waffle-iron:~$ vmstat -s
3549184 K total memory
3206708 K used memory
1918012 K active memory
1037320 K inactive memory
342476 K free memory
[Code]...
I know the system has 4096 MB of RAM installed, but why does it show only 3466 MB? Can this be interpreted as total "available" memory? Perhaps the missing 630 MB is being used by the kernel and cannot paged out?
I also tried this on on an Embedded Linux system and saw a similar result. The DRAM chip has 128 MB, but only 124 MB shows up in vmstat.
i got a RHEL 5.2 machine.and i noticed that the total used memory(as shown in "free" command) is 3GB higher thanthe sum of RSS size of all processes(collected using "ps aux").i know that its not suppose to be exact because RSS counts ultiple times shared memory (so actually it suppose to be higher than the used memory).the server runs apache which runs a pretty heavy php program.my suspicion is that its memory leak?
View 14 Replies View RelatedHow can i install total rpm packages in Server folder which is locket at /root/Server
View 3 Replies View RelatedI don't understand why, but my Slackware is totally crash after ~10min work. My guess is Nvidia is fault. Which logs I could see where the problem is? X (startx) work fine. My video card is: geforce 240. installed slackware 13.37 64 bit.
View 6 Replies View RelatedWith file command we can get the file type. File returns a unique answer for each file type. I want to get the total list that file can return for linux & solaris. For example, I have a partial list of file's return output. Unfortunately I can't see the total list from manual page.
ASCII C program text
ASCII C++ program text
ASCII C program text, with CRLF
ASCII C program text, with very
ASCII English text
ASCII English text, with CRLF line
[Code]...
is there a way to calculate the total memory consumed by user ?
View 12 Replies View RelatedI wrote a program that multiplies 2 matrices using multi-threads and another one using multiple processes and shared memory. Both in C.I need to find the total memory usage of these programs. I know of the top command, but when my matrices are relatively small they don't even show up on top because they complete so fast, how can I find the memory usage for these instances?Also, how can I find the total turnaround time of my programs?
View 3 Replies View RelatedHow can I display the no. of lines, words and characters for each file in current directory and in sub directory.
wc . * shows errornous result as there are some executable files in that directory.
I list all the instances of a running process my doing:ps -ef | grep myprogramThis lists all them.how can I simply output a count of how many are running?
View 2 Replies View RelatedI used Total Commander and connected FTP to write website. Today I accidently deleted some files. How to recover them?Recover using Total Commander or log in Putty? If using Putty, what commands are used to recover?
View 1 Replies View RelatedHow can you give total access to the system to a user other than root?
* Make the user a member of the root group.
* Change the UID of the user to 0.
* Add the user to the /etc/sudoers file.
I think none of these are correct answers.
how to find total size of all files whose names starting with a
OS: SunOS
du -h a* is giving individual file sizes.
Am I able to know how much data I received and sent till date since my MINT 9? I wanted to know is there method that counts total stats of upload and download since I installed My linux...System monitor is good for only one session..Once you restart the PC all gone.....
View 1 Replies View RelatedI have a really deep directory tree on my Linux box. I would like to count all of the files in that path, including all of the subdirectories.
For instance, given this directory tree:
/home/blue
/home/red
/home/dir/green
/home/dir/yellow
/home/otherDir/
If I pass in /home, I would like for it to return 4 files. Or, bonus points if it returns 4 files, 2 directories. Basically, I want the equivalent of right-clicking a folder on Windows and selecting properties and seeing how many files/folders are contained in that folder.
How can I most easily do this? I have a solution involving a Python script I wrote, but why isn't this as easy as running ls | wc or similar?
We are working on our subscription renewal and now since Red Hat has changed their subscription model we need to give them the number of physical CPU sockets on each system.I have tried looking thru /proc/cpuinfo as well as tried to parse data out from dmidecode but both of those solutions count each individual core as a CPU.Is there a clean and easy way to determine the number of sockets on each system? We also use RHN Satellite to manage our systems but I believe that is pulling the same data from dmidecode
View 2 Replies View RelatedIs there a software in linux ubuntu that can count scans???
View 1 Replies View RelatedI would like to count all the jpgs in my home folder I need a command like this:
~$ Sudo count -R /*/*.jpg
Anybody know and command to count any characters in file? I would like to know the total number of character " (quote) in file. My idea is to check if in a script the total number of this character is pair.
View 4 Replies View Relatedi try to make a script in bash that u choose a number for example 501 and another number like 1 and find how much the 1 number repeat in all numbers from 1 to 501 for example 11 -->1 repeat 2 times.in 1 to 501 the number 1 repeat 200 times.
View 4 Replies View RelatedI'm trying to count words in a text file that has a comma as separator. I know that I must user wc -w, but wc uses space as a separator
View 2 Replies View Related