General :: Random Numbers Between -5.0 To +5.0?
May 25, 2010How to create random numbers between -5.0 to +5.0
View 12 RepliesHow to create random numbers between -5.0 to +5.0
View 12 RepliesI'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.
[code]...
am writing a small search program for my class. I have decided to use indexing for my program. Ive researched online about indexing and how search engines do it. If im gonno do that I need to create inverted files to associate files to numbers ( numbers being the index of my paths ) . Now I was wondering what would be the best way to create an inverted file ? I was going to create sql tables using mysql api in C but then again there is no array data type or vectors to store few numbers in a single column in mysql and it is not advised to use Enum or SET
View 14 Replies View RelatedI'm looking for a script that copies a random .jpg from a random folder in my ~/Pictures folder to my ~/temp folder with a standard filename. This file will then be displayed in Conky. I can fix the last part, but I cannot find a way to do the first part.
View 3 Replies View RelatedCan anyone specify the methods how to add decimal numbers in Linux
View 5 Replies View RelatedOn my board there is no i2c lines out. So I am trying to get i2c over GPIO by GPIO bit-banging. How to use i2c-gpio driver? Where to set the gpio pin numbers for SCL and SDA?
View 1 Replies View Related I'm working with a rather large file of data taking from a tracking program on my phone, and trying to pull only the longitude and latitude from it. Any given line in the data looks more or less like this:
{"lon":-122.3083848,"time":1.273515839496E9,"source":"skyhook","nap":28,"altitude":0,"name":"location","hpe" :29,"bearing":0,"ncell":0,"lat":47.6544453}
I've run it through this command:
grep skyhook log-2010-05-10_18-17-28.json | cut -d"," -f1,10
to get this:
{"lon":-122.30872015,"lat":47.65812201}
{"lon":-122.3076686,"lat":47.6569975}
{"lon":-122.3079161,"lat":47.656395}
{"lon":-122.3096168,"lat":47.656218}
{"lon":-122.3096285,"lat":47.656206}
Which is a lot nicer, but I would prefer not to have to hand remove the non-number characters by hand since there are thousands of data points. what I could do to get it to just be longitude and latitude in 'number number' format?
Does any one know the process or commands to get the serial no: of a h/w device from a host?
I am looking for serial No: of Hdd,Graphic card,processor,RAM
I can get the serials of HDD & RAM using hdparm & dmidecode,but don't know how to get it for processor & Graphics card.
I want to use the Alt + numbers function in Ubuntu but I don't know how> I researched it first and i read I had to do Shift + Ctrl + numbers but ti doesn't work,
View 4 Replies View RelatedI want wondering if I can ls files that start with numbers only in a folder.
Suppose:
001.txt
302.txt
[code]....
Firstly I would like to say that Linux is very cool, especially the CLI. I have been trying to learn how to do some things in Fedora after being told Fedora was a good distro to get my feet wet. I have run into some issues and cant seem to find any answers. What Linux utility can be configured to automatically save the current logs?
How does your Fedora get an IP number? What IP numbers has your Fedora been assigned since it was installed (based on the logs you have)? What command did you run to determine the IP numbers? What command would you run to determine the number of times a user successfully used "su"? What command would you run to determine the number of times a user unsuccessfully used "su"? Having some issues with the file system as your Fedora boots up.
Any way to show the permissions with numbers (777) instead of with letters (drwxrwxrwx) using "ls" command or any other command ?
View 2 Replies View RelatedI am trying find files in a directory that contain numbers. I have tried ls /etc *[0-9]* but that doesn't work. If I cd to /etc and run ls *[0-9]* it almost works but it also includes results from within files. My last thought was to try: find /etc [0-9] -type f but this does not work either. My second problem is that I am trying to get list of files in a directory that were changed less than 10 hours ago, using grep, while leaving out directories. I am completely stuck with the second problem.
View 8 Replies View RelatedOur assignment is to take in two numbers and add them. While the inputs will always be numbers, we are to inform the user if they are doing it wrong. My code:
[Code]....
The code worked fine before I tried to idiot-proof it. I'll probably end up nesting the if statements checking if the first two inputs are not null, but I'm more annoyed at why the script isn't working.
In the file /var/log/kern.log, I see kernel logs in the following format,
Oct 6 11:18:30 machine kernel: [212.443755] Some logs...
What are the numbers in the bracket [212.443755] stands for?
I am a newbie in Linux. Here is my question....
Create the file ~/license_counts, which tables the number of occurrences of packages which are licensed under a given license, for the top 5 most commonly used licenses, sorted in numerically descending order. If performed correctly, your file should be formatted similarly to the following. (Do not be concerned if the actual counts or license names are different. Also, you might notice logically similar licenses, such as LGPL/GPL and GPL/LGPL. Do not make any attempt to combine them into a single entry.)
The resulted format:
I tried some method but cannot get it to work.
Is it possible for listing directory and files' permission into numbers?
Generally ls command shows directory and files' permission as follows;
[root:maestro:/home/ddisk_net]# ls -al
Total 44
drwx------ 4 ddisk_net users 4096 7월 20 10:40 .
drwxr-xr-x 21 root root 4096 7월 20 10:28 ..
-rw------- 1 ddisk_net webteam 5 7월 20 10:40 .bash_history
-rw-r--r-- 1 ddisk_net users 33 1월 22 2009 .bash_logout
[code].....
I am using RHEL 5. In my Linux Box I have two Lan cards (eth0 and eth1). "eth0" is connected with network 192.168.10.0 and "eth1" is connected with network 192.168.11.0. Both Network are inter connected via routing. Now I want a situation where, I want to dedicatedly assign some port numbers against a lan card. Like eth0 will be assigned for ssh (22) and eth1 is assigned for telnet (23). So that, when a user connect to 22 port then he/she is connected to the server through eth0 , and when a user connect 23 port then he/she is connected to the server through eth1. Is it possible to do using iptables or other?
View 2 Replies View RelatedIs there a command to return a recursive listing of sub-directories and the number of files in them? I have found plenty of ways to give me the total number of files in a directory structure, but none that gives a list of the sub-directories with the number of files in them. "du" gives me a listing of directories with their sizes, but I couldn't find an option (or any other way) to give me the number of files as well. Ideally, I'd like to get list with "Size" "Files" "Dir name" - And the order of the columns doesn't matter. Is there a "simple" command line solution or do I need a shell script for that?
View 5 Replies View RelatedTo encrypt the text, we take the word "python" and make it at least the same size as "welcome home" by repeating it as follows:
w e l c o m e h o m e
p y t h o n p y t h o n
Then, we convert each letter into its numerical ASCII value as follows:
w e l c o m e h o m e = 119 101 108 099 111 109 101 032 104 111 109 101
[Code].....
And, finally, we convert the numbers back into their corresponding ASCII character:
I have huge files, wherein some lines begin with a number. I want to convert that number to a bookmark link
Sample file:
Code:
C.S. Lewis (I think) wrote:
1 If war is ever
2 legal, then peace
3 is sometimes
4 sinful.
Text without numbers toom I need the numbers to be <a name tags where the id is the letter x and the number that is at the beginning of the line:
Code:
C.S. Lewis (I think) wrote:
<a name="x1">1</a> If war is ever
<a name="x2">2</a> legal, then peace
<a name="x3">3</a> is sometimes
<a name="x4">4</a> sinful.
Text without numbers too I'm not sure why I can't get this, but after hours of 3 line long seds and endless while read lines, grepping ^[[:digits:]]s I can't figure it out.
as a result of a find command, i have
852065 72: /bin/gunzip
852065 72: /bin/gzip
852065 72: /bin/zcat
(the first column is inode number and the second is size if you're curious)
I want to be able to format it in a way such that:
852065 72:
/bin/gunzip
/bin/gzip
/bin/zcat
I know I can get the bottom half using awk- but I can't figure out how to extract the first set of numbers and get them to appear only once
I am trying to find a way to replace a set of sequential numbers in a file with a different sequence using sed. This might be done easier using awk or some sort of bash script, but it seems to me there must be a way to do this easily with sed. Basically, what I am editing is a Cisco switch config. I want to change the sequence of ports to a different numbered sequence. Here is an example of what I am trying to do.I want to change for example, the file:
Code:
cat testfile
interface FastEthernet0/1
[code]...
I have a text file with content that look like this..
Code:
1,3927,"AIS"
1,6928,"AIS"
[code]...
I am looking for a way to search for large numbers in text files and print the nearby lines.
For example if I had a text file like:
Event: 11
blah: 3
blah: 41 bleh: 19
Event: 2
blah: 31
[Code].....
I have a program that prints out lines like:
And I want to be able to pipe it to sort on that third column, by letter first, then number. But I keep coming getting files sorted like:
(field separations all start at same place, so columns are not jagged like above.)
I have read the sort man pages, and have tried -n for the numbers, and -k for the position to start sorting, among other things. I also tried inputting a second position to start sorting, which sort should supposedly refer to if the two entries are identical at the first place being compared, but it seems to just ignore the second one. I just can't get it to sort the numbers properly...
For now I am manually opening the file in emacs and changing them around, needless to say, very time consuming.
I'm writing a bash script where I read a text file (containing a column of numbers) and store each line in an array. There seem to be some problems with the whole thing however, but only for some files and not others. Here's what I do:
Code:
#!/bin/bash
file=time_notOk.txt ### The file with a column of numbers
i=0 ### Array counter
### Read the file
[Code]....
I just bought a new mouse - just a cheapie usb wheel mouse but it has an extra 'thumb' button which I thought I might as well set up to do something useful. I used 'xev' to determine the numbers that the OS had assigned to the buttons, and I found it wasn't quite what I was expecting:
left = 1
wheel-as-button = 2
right = 3
wheel-up = 4
wheel-down = 5
thumb = 8
I thought the right button would be '2' and the 'wheel-as-button' would be 3 - that's just how I've always seen them referred to in explanations, and I thought it was standardised. Not a big deal - the context menus still pop up when I click the right button so it all works ok. (And I just discovered the wheel-as-button does a 'paste' operation when it's clicked. Weird - I've never noticed that before...) But the thing that I find particularly odd: why is the thumb button assigned as '8'. What happened to '6' and '7'? Does the operating system assign these numbers, or are they built into the hardware in the mouse itself? Again, no big deal, I know I can remap the buttons if I need to, but I was just curious as to how this all works and google didn't help.
I am trying to strip the numbers from the 5th columns and just get letters - in perl - i tried using subsrt, chop. and a regex -
what i want to get is:
i tired appending a regex perl -nle 'print /(w{1,20})d{1-20} but it did not work.
I have two NASes. I work off of one, and the other is used as a backup. As I have it set up now, it's slow. Running a backup takes a week. Even for 7 TB, with 1,979,407 files, this seems a bit outlandish,particularly as both systems are RAID-5 and the network is all gigabit. I've been digging about in the rsync man pages, and I really don't understand what differentiates the various topologies.Right now, all the processing is being done on the backup NAS, which has the main volume from the main NAS mounted locally over SMB. I suspect that the SMB overhead is killing me, particularly when dealing with lots of files.
I think what I need is to set up rsync on the main nas as a daemon, and then run a local rsync client to connect to it, which would hopefully allow me to completely avoid the whole SMB-in-the-middle affair, but aside from mentioning that it's there, I can find very little information on why one would want to use the daemon mode for rsync.
Here's my current rsync command line: rsync -r -progress --delete /cifs/Thecus/ /mnt/Storage/input? Is there a better way/tool to do this? Edit:Ok, to address the additional questions: The "Main" NAS is a Thecus N7700. I have additional modules installed that give me SSH, and it has rsync, but it's not in the $PATH, and I havn't figured out how to edit the local $PATH in a way that persists between reboots. The "Backup" NAS is a DIY affair, built around a 1.6Ghz Via Mobo with a Adaptec Hardware RAID card. It's running CentOS 5 with a full desktop environment. It's the hardware I'm running rsync from. (Gigabit is through a additional PCI card).
Further Edit: Ok, got rsync over SSH working (thanks, lajuette!).I had to do a bit of tweaking on my command line, I'm running rsync with the args:rsync -rum --inplace --progress --delete --rsync-path=/opt/bin/rsync sys@10.1.1.10:/raid/data/Storage /mnt/Storage (Note: I'm specifically not using -a, because I want to change the ownership to the local account, to not freak-out SELinux)