Programming :: Awk - Calculate The Number Of Words Containing Letter E In A Textfile?
Oct 12, 2010i need to calculate the number of words containing letter e in a textfile.
View 9 Repliesi need to calculate the number of words containing letter e in a textfile.
View 9 RepliesE.g. 98 is represented as 1100010 (number of valid bits is 7)
What is the formula to calculate the number of valid bits in a byte ?
User submits a ms word file, and the php can recognize the number of words? Is it only possible for ms win server?
View 1 Replies View Relatedi have this file, and considering it's obnoxiously huge i'd prefer not to have to do this manually. Is there some way i can manipulate sed or awk to change every other letter in all the words in a file to capital letters?
View 7 Replies View RelatedI have a text file example :
word1
word2
word4
[code]...
Everyone who deals with Linux knows that partitions on hard drives are designated as "sdx#", i.e., sda1 sdb2, etc. I know through experimentation that the number portion of the designation is assigned not according to order on the disk, but chronologically in the order they are created.
Further, if you have several partitions on the disk-say, sda1 through sda3-and you delete sda2, the designation of sda1 will remain the same, but sda3 will become the new sda2. The creation of any further partitions on the drive will start with designation sda3 and increment from that point.
At times this creates a conundrum, especially concerning bootable partitions. Some time back I rendered a partition containing OpenSUSE unbootable because of this, even though Ubuntu owned the GRUB bootloader in the MBR. Ubuntu's GRUB could find and point to the partition using the command "sudo update-grub", but when OpenSUSE took over the boot-up process, its GRUB was pointed to the wrong partition and would freeze up.
My question is this:
Under Windows, one is able to make a Drive letter persistent. Windows will keep the drive letter for that partition and assign around it. Is there a way to change a drive designation number, or at least make it persistent, under Linux? It would be a handy method to forestall these types of booting problems, among other things.
Presently, when a person has installed Linux side-by-side with Windows and want to delete the Windows partition and expand the Linux partition into the free space, I will tell them to format the partition, then shrink it to next to nothing instead of deleting it. This preserves the partition ID scheme while giving them the space to expand their Linux partition into...especially helpful with a seasoned Linux installation that would be a PITA to reinstall and set back up.
Oh, and I already know about UUID. This article explains it, but if you look down through the comments, you will see reasons that it is problematic for desktop application and usage. I want to make it as simple as possible for new Linux users (and myself! ).
need a script to achieve saving multiple text files as 0001 0002 0003 etc.or moving files to a folder displayed this way..there prolly is an " if " statement involved also...if 0001 exist then %+1 and so on.
View 1 Replies View RelatedI am new to Linux ,i did one project in windows which will block the thumb drive with respect to serial number(Device instance ID) of the device.i am planning to do the same project in Linux using c/c++.I am very new to Linux,there is no drive letter for thumb drives we insert into Linux OS.How to get Drive letter and how to get Device instance id of thumb drives please help me get some clues.please provide me any tutorial or any links .w if have any other clues to block devices with respect "block list" and "allow device list".if the serial number in block list it has to block if serial number in allow device list it has to allow thumb drive to access.
View 3 Replies View RelatedNot sure why this won't work, any thoughts?echo enter the letter A or the letter B
read letter
if["$letter" = "A"]; then
echo "coolit's an A"
[code]....
I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.
1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".
2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.
Quote:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!
[Code]...
I have a string such as "helLo wOrlD". I'd like to transform this into "Hello World", ie. capitalise the first letter of every word, and transform the rest into small letters, both being compulsory.
View 9 Replies View Relatedive searched around about this for a bit, but have been unable to find a working and suitable solution for me to do, what i require is to be able to change a string such as:hIs Is a TeSt to --> This Is A Test - AND place it in a variable - so far ive only succesfully been able to make the whole sentence uppercase or lowercase.
View 2 Replies View RelatedI want to calculate length of my array, say Unix here.
Code:
[linux1@HMLINUX1 abc]$ declare -a Unix=('Debian' 'Red Hat' 'Suse' 'Fedora');
[linux1@HMLINUX1 abc]$
[linux1@HMLINUX1 abc]$ echo ${#Unix[@]}
5
This should be ideally 4, but somehow it is showing as 5. However, when I am removing the space as RedHat instead of Red Hat, it is working perfectly.
Code:
[linux1@HMLINUX1 abc]$ declare -a Unix=('Debian' 'Redhat' 'Suse' 'Fedora');
[linux1@HMLINUX1 abc]$ echo ${#names[@]}
4
i've been using a awk script to calculate my data... i have 3 files:
file a1.txt:
2
3
4
[code]....
the results were (3.5, 6 and 3) which is pretty easy.. now i want to combine all this into 1 file and each have different columns and called it avg.txt which have something like this in the end:
3.5 6 3
i have a sorted file with many repeated lines like this:
1ujw
1ujw
1ul1
1us7
[code].....
i need to calculated haw many times each line is repeated, for ex
1ujw 2
1ul1 1
1us7 5
etc.
I want to calculate log in bash script. I searched but could not find any bash command to directly do it. I am also thinking to send the variable in C program, calculate in C and get the answer back in bash script.But I think it is a long process. as I have to do this
i) gcc -o log log.c
ii) ./log > log_result.txt
iii) then read the result from log_result.txt
im trying to calculate how much time does my program run, use very simple script
clock_t end, start;
start= clock();
int i;
printf("initial %d
",(int)start);
[Code]....
but it outputs 0 all the time. cant figure out where could be the problem.
i have the example code below, i want to calculate the time taken for a sample program to run. but i keep getting undefined reference error.
#include <sys/time.h>
#include <iostream>
int main(int argc, char **argv) {
struct timeval startTime;
struct timeval endTime;
[Code]...
i'm trying to write a program with c socket programming,what i am trying to reach is a program which will calculate a computer's downloaded data from the internet,just to know how much he/she download?
View 1 Replies View Relatedı need to calculate how many nanosecond the process takes . must give the same value every time (c++) ubuntu 10.10 my system information:
*-cpu
description: CPU
product: Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
vendor: Intel Corp.
physical id: 400
[code]...
I'm using pyqt3 for my app and am lost on even how to attempt this task... On a vinyl cutter to have the blade pivot it must be offset from the center of the shaft it's on so say for example a .25mm offset would leave a .25mm unwanted vinyl attachment when the cutting is done. I somehow have to average or extrapolate that .25mm xy coordinate and add it to the hpgl plot file as a PUx,y; command? I have enclosed a simple sample file that has three images in it. In the corresponding hpgl file everything between the PU commands that are starting with PD are the code for that image (star for eg the pu to move to next image and then all PD for the next image and so on, so once the formula or procedure is figured out it can be applied to as many images there are in the file. Placing the new command at the head of each image PD group. Since there are absolute and relative cutters I enclosed the same exact plot for both types as the coordinates on relative can be negative numbers. Only PU and PD commands and a ";" as a command delimiter as sometimes many commands are on one line.The offset variable will come from a spinbox but .25 is good for an example.
View 14 Replies View RelatedIm doing a sudoku-solver as a school assigment in Java. It is supposed to solve both 6x6, 9x9 and 12x12 boards.Im pretty much done with my algorithm(brute force), but I'm having a hard time figuring out how to calculate the right Box for a Square. I found this snippet:
Code:
// calculate BoardPos for index, where index is 0..80
void loadBoardPosFromIndex(BoardPos &pos, int index) {
pos.index = index;
[code]...
This works on 9x9 boards, but I really dont get the math behind this, and how I can create a generic rule for both 6x6, 9x9 and 12x12 boards.
Trying to change to upper case first letter of every word over a specific column.
View 10 Replies View RelatedFor example if i have the following "OneThree" and i want to add the word "Two" between "one" and "three". To have "OneTwoThree" How can i do this?
View 2 Replies View RelatedThis array is supposed to contain 12 elements (names of the month) What I want to achieve is that depending on some user input (a number 1-12) a full name of one of the months will be displayed, eg.
Code:
scanf("%d", &month);
printf("The month is %c", months_names[month]);
I'm trying to write a script that will calculate a directory size and if the size is greater than 4GB, it will send out an email. But I am getting the "integer operation expected" error when it tries to calculate the current disk size. Here's my script.
Code:
TO="user@email.com"
SUBJ="Ready for DVD burning on `hostname`"
MAIL="/bin/mail"
[code]....
how to calculate (if possible) the end address of an image file in a flash memory. I'm trying to create a checksum and checkheader function and the info that I got is the file's offset, how many sector it consumes and its size. I kinda need the end address, sad thing is, I don't know how to calculate it.test.img's start address is 0, the size is 0x20000 and consumes 3 sectors.
View 6 Replies View Relatedi want to make a script that change the names of files and folders into small letter because they are all in capital and more than 1000 fileit is impossible to do that with my hand
View 14 Replies View RelatedI'm trying to calculate the minutes difference between two dates using the function mktime() on c++. The dates will be passed to me as struct tm, and I will use this function many many times. The example below shows what I wanna do:
Code:
int main(int argc, char** argv) {
while (1) {
tm date2;
tm date1;
[code]...
I read the mktime() description on c++ reference, searched google... but there is no light
im trying to find a way to extract the phrase between the words Connection and is (ie the underlined words below). Can we use awk to do this? How? Is it the best command to use?
Code:
[06:25:00][i] Connection at Plant A is live
[06:25:00][i] Connection at Building_C is not live
[07:25:00][i] Connection at Terminal D is down