Programming :: Bash: Generating A Random LETTERS Sequence?
May 12, 2011
I tried googling around but i cant find anything related to this: everyone seems just interested in random numbers, so when it comes to random letters there is a lack of informations. However, i am trying to figure out a wait to get a random letters string that matches a simple rule: it must be a sequence of consonant+vowel. So for example, these are some 6 letters strings i would like to obtain: wolupa, tafoke, zewevu, cupimo.
I want to write a function which calculates the space needed between fields, to generate a table with aligned fields, like when you type "ls -l", the operating system generates a table with beautifully aligned fields. I've got this code so far:
Code:
for line in $(cat tmpSearch) do line=`echo $line | tr ":" " "`
I have a text file that contains many lines that look like this:
I'm trying to make my script read this text file, find the string sequence "QIEN", and delete everything from this sequence backwards (including "QIEN") so that the above lines look something like this:
I'm aware that grep is good to do a regular find-and-delete as follows:
Code:
But this will delete everything on the lines that contain the string sequence "QIEN".
I'm learning shell scripting using bash and I want to generate 4 floating point number with 5 decimal places and write them to a file and a variable. I've done all this except the $RAMDOM enviroment variable does not generate a float number but a integrer.
I have a wireless keyboard and for some reason it is typing random letters, symbols, and numbers while I am not even touching the keyboard. I tried a different wireless keyboard and that worked for awhile, but even that started to do the same thing. I plugged in a cord keyboard and that has been working fine, but I am unable to type my password if it goes into sleep mode or select my windows partition. It's very confusing and I plan on reinstalling both windows and linux anyways it's that time, but I have to figure this problem out before I do.
I have searched and searched and maybe I don't know how to articulate this issue with out just posting the problem I'm having. Every time I bring up a terminal window I get the following "Header"
To be honest I cheated and used the .bashrc / .profile files from Ubuntu and all was working fine for a while now and it seems something changed to cause this... any ideas on why I am getting this? I checked my .bashrc and my /etc/profile and it doesn't look like anything is amiss..
I'm creating a bash script that contains the following line:"ssh user@$server1 cd /tmp; pwd"What I want is to print /tmp of server1, but the script it isn't printing that
how to generate excel charts from C, or if it's possible at all? For example, if I had 2 arrays that I wanted to export to excel and graph against each other. I know how to export it to a csv file, that's no problem, but I have no idea where to start with generating a graph of the data. I can't seem to find any examples anywhere. Just a simple example to show you what I mean: Code:
char arr1[] = {'a','b','c'}; int arr2[] = {10,20,30}; int main ()
Unfortunatelly since i have no background at all about GUI programming, i dont know even the keyword for that i want to generate a pop up window from my program (written in C) which show a message and an OK button. in my opinion, maybe i should use directly the Xlib library and not the GTK or QT library for example so the program can work almost on every linux system. A code snippet/hint for the pop-up window then?
Im strugling with script that wil generate graph on demad. I put it in cgi-bin directory but cannot get it to work. i googled for perl generating images and tried few examples but none worked.
When I execute perl script in command line it throws picture i a bunch of characters so it creates it but wont show when I access it through a web page.
I'm trying to write a program that generates a random number and then tells if it is prime or not. I have doe some research about how to calculate prime and random numbers but I'm still having trouble. I don't really get how to calculate a prime number. I know a prime number is a number that is divisible by 1 and and itself. how to calculate a prime number in C?
I'm trying to understand how interrupts work. Is there a way to generate timer interrupts in C. Also can we enter into the protected mode of the CPU. Does OS (specifically, linux) place any restrictions on user programs entering protected mode. If it does not, do we just have an assembly language program which changed the mode, followed by the C code... I'm just trying to understand how things work at the lowest level. So I'm trying to write few snippets to test my understanding.
Recently I faced a problem in typing in English in OpenSuse 11.3.When I try to type in English it shows me Greek letter and worse than that I think it is really Greek (not only in font) because when I enter my passwords or try to type a command in terminal I get error,I tested with UK and USA and all other English languages and I still have this problem. I even do reset in my keyboard layout setting and in KDE setting but it didn't help.
I know how to manually writing a makefile for my project, but I am new in using makefile & configure file generation tools like automake to generate a makefile and a configure script file.
I had done research on tutorials for generating makefile and configure script file.
I know that I need to manually write two files (makefile.am and configure.in).
I use wxWidgets GUI library, libconfig library, and libpcap library to do my project.
wx-config is a tool that can return the library files and include directory for wxWidgets library.
When using g++ to compile my files, I need to add in this line "`/wxlib/bin/wx-config --version=2.9 --static=yes --unicode=yes --debug=yes --libs`"
I am running some muti-threaded code that uses a lot of memory (~6GB). I have it compiled on a cluster that uses Xeon 5160 quad core CPUs with 4MB cache/core, 8GB of RAM and kernel 2.6.18 (x86_64) and I have also the same code compiled on another cluster that uses Opteron 2214 quad core CPUs with 1MB cache/core, 8GB of RAM and kernel 2.6.28 (x86_64). On the Intel cluster the code generates barely any system load when I look on top but on the AMD cluster it can generate over 50% of system load. On the intel machines my process can generate a constant load of 3, while the load generated by the process on the AMD machines is about 1.6.
Does anybody know what could cause this? Could it be the version of the kernel or the difference between the CPUs (for example, the much smaller cache of the AMD CPUS)? My software and all its dependencies are the same on both clusters. I am also using the exact same version of GCC to compile everything.
I am trying to write a loop to open four main-data-files. At each open of the main-data-file, I want the loop to open another four sub-files and split the data from the mail-data-file according to the creteria and dump into the four files. When the loop goes to the second main-data-file, it shall generate another 4 sub-files with different file name. And the process goes on. That means I will have total of 16 sub files for the four main-data-files. Each four files from the 16 files shall have specific name on it. Based on the code which I given below, I would say when the file at UNIT=100 is opened, 4 new files needed to be opened as well. They are:
Is it possible to generate keyboard event "Ctrl+c" from a shell script code.? I have written a shell script to compile my application and copy it to the server home directory, inorder to run my application I need to start the server (by running a shell script). But before that I need to stop the the currently running instance of my server. To do that I have to generate a keyboard event (Ctrl+c which I press it manually). I want to automate the entire process by writing a shell script I am able to run the server just by adding ./run.sh in my shell script. But before that to stop my server can I generate a keyboard by using a shell script event(ctrL+C) to stop server.?
Generating avi files for movies directly from gfortran programs. I make movies from my Fortran codes using seismic unix - SU. Need to modernize this method to make avi movies or something similar. I am quite adept at generating "C" binary files from Fortran. Have not been able to find the documented definition of AVI file format.
i could find is crunch2.9 password generator but at the moment it does not suport the function that i am looking for. My aim is to generate : 10-character combinations of the following characters (lowercase) 23456789abcdef with no more then 3 same letters repeates no metter side by side or within one line (sequence) so lets say
abcdef1234 accept fabcde1234 accept ffabcd1234 accept which is probably permutation with repetable string ( where abc is not equeal to cba etc .so ti speak position does metter) fffabc1234 not acceptable -----(3 same characters) ffabcf1234 not acceptable -----( 3 same characters event thought not side by side)
so generally we dont want 3 same characters apper in same line.
I have to write a code that converts a sequence of 1's and 0's(block) into their equivalent hexa number and copying to another array(byte). but this sequence is not always of length 8 and you are required to send strlen(sequence)%8 bits back into the string. So i've written down this code and it works well with the sample input but fails in the real program.
Code: int Convert_encode( char * block,unsigned char * byte) { int len,iter,i,j,k,sum; char * temp=(char *)malloc(4*sizeof(char)); len=strlen(block)/8;
I'm beginning to write a custom RTP implementation and want to test its resilience to UDP traffic. I've searched on the web and all the links I can find are for analysing actual traffic, not generating it or messing it up.
Does anyone know of any software (preferably free software) that will, for example, take actual UDP traffic and drop packets, duplicate some and make some arrive late/out of sequence?
I am faced with the following problem; I need to update all fields of type datetime without ... with the following sort data:01-01-2010 12:10:30.256 - this is just an example.these fields are restricted with a unique constrained. My question is how can I generate the above sort data, especially the last three numbers with leading point. After that how can I update a table with existing data with this newly generated data so that the fields really do carry unique data.As you probably can read out of my question, I read through the help in pgAdmin and came as far as generating date, maybe datetime but not the .123 number. And a little insert script I found in the help, that I modified as UPDATE resulted in updating only the last generated data in all required fields.
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.