General :: Count How Many Number Occurrences In Series?
Jun 2, 2011
i 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.
How do I find a string in files in a directory. And these file names begin with letter a. I also want to get the number of occurrences of this string from the grep I run. I tried this: cat * | grep -c string but it searches all files. I just want to search files that begin with letter a
I am using grub of version 2, and current resolution vga=795 (probably). X runs at 1680x1050. So what I would like to know is, how can I count the right VGA parameter number for grub, to use another resolution?
I am a noob and I am trying to display a count of the number of subdirectories in a directory. I have been able to use find -type d to list directories and subdirs but I want a numerical value of dirs and subdirs. I know ls -l gives a count but when I try ls -l -d all it shows is "." I also have tried a combination with the -R option but nothing seems to be working for me.Please forgive my ignorance but I am working on a script for class and this is the first step.
i need to count the number of files and put the output into a variable. i used wc -l filename but i couldnt find an option to put the output to variable. example if the number o line is 5, i need the output of echo $x is 5.
I 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.
I have been looking at Open Office calc to work the next in a series if non-linear numbers, and calc does do a very good best fit and shows the equation. Just what I want. I now want to programme this into a C routine that I am writing so that the programme will both look-up what it can from a samples database, and extend them forward where it does not have enough samples. (I'm trying to understand some correlations). My thought at present is to take the Ooo calc formula and write it into my code. Before I do so, I wonder if anyone knows of any non-linear solver routines written in C that I could just plug in? I'm trying to do a best fit from only about 6 very accurate floats which graph like a curve.
And I'm trying to count the number of slashes in each line. I figured (with my limited knowledge of bash) that the best thing to use would be sed. So I ran this to print "not /": sed '!s////g' file # and eventually adding " | wc -m" to it. and I got the same result as if I ran cat, no modification at all:
I recently found myself in possession of a large file (a few million lines in length) of short strings and would like to count the number of lines that are unique to the file. I thought this would be an easy process, but while working on the problem, I encountered the following. Can anyone explain this weird result to me?
I'm trying to find a script that will return me the largest number of repeating characters. Say, I have the following line in a text file: 12345AAAAA6789AAA
I want it to return 5, because "A" is repeated 5 times in this line (more than 3 at the end).
For reasons I can't even begin to figure out, the number pad does NOT work.i can get the num lock light to come on, but pressing the keys there produces no love at all. Right before I installed F10, my F8 x64 had been working flawlessly for a VERY long time and I have been able to verify that the keypad still functions both with the M$ Windoze Vi$ta virus and a live Knoppix CD.Since this is the first time I have had this issue, I don't even know where to look to consider solving this.
I did try the System->Preferences->Hardware->Keyboard and all of the HP layouts listed there, but I still can't get anything more than the Num Lock light to come on and go out.
I'm the POC for all my families Linux computers. Is it possible to get statistics on which programs are accessed, how frequently, for how long and by which user?
When it comes time to upgrade it would be useful so I know which programs to concentrate my testing. I usually just e-mail and ask but every time people forget to send me the programs they actually use.
I am trying to get the count of number of CD-ROMs attached with my Linux system using a bash shell script. I have decided to use the following method for it:
I need to create a script to count the number of lines from a text file . The output must be put on another text file (no_lines.txt) and in this file i need to generate from the script this output :"File $FILE has $NO_LINES lines ".
I would like to parse an input file in which there are two columns per each row. We want to see how many lines are duplicated where we define duplicate to be having the same second field and different first field. For instance if the input file looks like the following:
#!/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 have a problem with the latest Fedora. Installed it cleanly on a machine with Gigabyte H55M-S2 with Intel Core i3. There seems to be no sound and I checked to see if anything is muted but is not. The manual says that the sound chip is ALC888B so this could be the first problem. Any ide how I can make it work? Here is a dump of some things on my system.
Code: [weaz ~]$ lspci | grep Audio 00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06) [weaz ~]$ uname -a Linux EarthwormJim 2.6.35.6-48.fc14.i686 #1 SMP Fri Oct 22 15:34:36 UTC 2010 i686 i686 i386 GNU/Linux
Sempron 3100+, 512mb 400mhz RAM, Ubuntu 10.04 32-bit.From what I've noticed, the computer seems to primarily lock up when an internet browser is open and/or being navigated (I'm testing this observation, now). I've tried Firefox and then installed Chrome; same thing.CTRL+ALT+F1 unresponsive, mouse is frozen.Note that this is an old build given to me by a friend. The build originally had one stick of 512mb and 256mb. I took out the 256 for diagnostic purposes. Additionally, the computer originally had an nVidia 6200 graphics card, which I replaced with a 6600 I had lying around--again for diagnostic purposes. I installed the recommended video drivers respectively. After three re-installations of Ubuntu, 2 different browsers, 2 different graphics cards, running memtest86 and singling out the RAM, and using a can of air to eliminate any overheating issues, I'm unsure what to do next. I have a feeling this is operating system related, though. In BIOS, the CPU fan seems to be running at fine RPMs, but no temperature is given
Do note I am entirely new to the Ubuntu/Linux OS, and wanted a cheap, nice solution for this salvaged PC that I'm giving to my little sister. edit #1: Left the computer idling on desktop with no browser open; seemed okay for hours on end. I opened Chrome to the google homepage (with the Pac-Man flash theme at the time), and it did not freeze then as well when set to idle for hours at a time.
I'm trying to process a postscript file and I want to change alternate pages by finding the string '%%EndPageSetup' (and then adding a line after it).
I've tried using sed with labels and a branching program to ignore the odd occurrences and process the even ones. In the code below I tried searching for the first and ignoring it by jumping to next and processing it and then to the next odd page and so on.
My logic is obviously flawed here as it doesn't work but I've tried the following:
Code: #!/bin/bash sed -e '/%%EndPageSetup/{ b even :odd /%%EndPageSetup/ b even :even s/%%EndPageSetup/%%EndPageSetup++/ b odd}' filename.ps > newfile.ps