Programming :: Allowing Export To Take Numbers As Variables?
Jan 26, 2011
I'm playing around with some shell scripting and I've got a directory call CS005 and I'm trying to write a script to I can locate to the directory really quick and easy.
export CS005DIR=/home/stud/0/043234/CS005
Now I get this error
CS005DIR=/home/stud/0/043234/CS005 No such file or directory.
This is because I've got numerical values within my variable.
Is there a way to allow numbers for variable names?
View 3 Replies
ADVERTISEMENT
Apr 19, 2011
I am working on a project but it consist of a large amount of numbers. I have tried using OpenOffice to produce this list of numbers but it keeps crashing when I reach a certain point. So I was looking for some help. I need to see if someone could either help me with using a script or program to export these numbers into a .txt file or if someone could just make the list for me.
I am looking for a text file that will have the numbers 1000000000 to 9999999999 in order. I understand this is a large amount of numbers but this something I don't have the time to just do manually and each time I try to do it with OpenOffice it crashes around 1009000001. Oh and I need the text file to look like this:
1000000000
1000000001
1000000002
1000000003
View 2 Replies
View Related
Mar 15, 2010
I can't seem to find how to export a variable to all processes I run under my user? I have an application that needs this variable, and currently I have to manually export this variable (typing "export VAR=... in terminal) every time before I run the application.
Which profile file I have to put the export expression into? I want all processes to inherit this variable, not just the shell/terminal. I.e. a true environment variable...
View 7 Replies
View Related
Oct 27, 2010
I want to export the env variables in a file using a script,i tried using the below:for var in 'env'
do
var2=env|awk -F '=' '{print$1}'
echo "$var;export $var2">file.txt
[code]...
View 9 Replies
View Related
Feb 19, 2010
I created variables in python and would like to be able to incorporate those into bash commands that will be mixed into the script. Example:
Code:
name=raw_input("Type your name and press ENTER: ")
import os
os.system( echo "name")
Of course this doesn't actually work, but i think you get an indication of what I am trying to do.
View 1 Replies
View Related
Apr 4, 2011
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 Related
Apr 27, 2010
I can define all variables in tcl programming in a file for instance var.cfgand source the same file in my tcl script such assource var.cfgIs this possible in perl too?
View 3 Replies
View Related
Jun 12, 2010
seahorse export menu is always disabled. I need to export the passwords to restore it after formatting my machine.
View 1 Replies
View Related
May 10, 2011
I'm trying to setup a kickstart installation and having some trouble with firewall settings. When you do a manual install it gives you the option on first boot to allow https, samba, and nfs4 in the firewall. I have as yet been unable to find the options for doing this in kickstart. Here is my current firewall line:
firewall --enabled --http --ftp --ssh --smtp --trust=eth0
I have tried just adding --https but it errors on me. Am I just missing the keywords to set these up? I have looked but i can't find keywords for any services except telnet that are not already included in my firewall line. Should i be trying to do this with iptables in post rather than in the kickstart itself?
View 1 Replies
View Related
Feb 1, 2010
I have some code that opens a directory and reads in the names of files which are e.g. 0001, 0002, 0003 up to 9999I need to get all these numbers and then generate a new number that is not one of these numbers already.here is my code to check the files in the directory
DIR *d;
struct dirent *dir;
int i = 0;
[code]....
View 11 Replies
View Related
Feb 11, 2010
write a script in bash or shell to add the numbers between and including two numbers
View 3 Replies
View Related
Nov 16, 2010
I am developing using vb6 to export a chart (line graph) to OpenOffice Calc. I am using:
Code:
Chart.diagram = Chart.CreateInstance("com.sun.star.chart.LineDiagram") to create the LineDiagram. However, it is just a line diagram. What I need is a line graph with points plotted on it. How can I make it to LineDiagram with LINES AND POINTS?
View 7 Replies
View Related
Apr 1, 2010
As some of you know that I am new to this forum. I have another problem that I got stuck on. I have this file called "Fib.rbb" and my instructor told us to write an interpreter program by using Fib.rbb.
"You are to write an interpreter in Perl for Rongs Basic Basic (RBB) as explained in class. The BNF description for RBB and a test file called Fib.rbb are part of the RBB.zip file which is available in the Course Documents folder on blackboard. If you call your interpreter myIntp.pl, you would execute the program via perl myIntp.pl Fib.rbb
Code: Print "A few Fibonacci numbers:"
View 3 Replies
View Related
Mar 28, 2011
Looking for code to add 5 numbers in assembly? I want to use array for input of those 5 numbers. No problem if the output is 1 digit(0....9).
View 3 Replies
View Related
Dec 22, 2010
I am trying to extract 2 numbers from a same file and my goal is to print them both in another file, on the same line, separated with a space. I have to do that for 20 files and I would like to have therefore 20 lines like this in the output file. It would look like this :
Quote:
number1_file1 number2_file1
number1_file2 number2_file2
...
...
number_1_file20 number2_file20
So far, I did only extract one number and got an output file like this :
Quote:
number1_file1
number1_file2
...
...
number1_file20
And I did this by running a bash script with the following content :
Code:
#!/bin/bash
ls execution$1$2*.* | while read filename
do
cat $filename | grep -e "Total aborts:" | cut -d " " -f3 >> abort$1$2.dat
done
$1 and $2 are just strings to identify the different files I want to consider in this loop. This script works well to extract a number which is the 3rd field of a line starting with "Total aborts:".Now, how could I change this script to do what I mentioned above (i.e. extracting two numbers from two different lines) ? The second number is the 3rd field of a line starting with "Total throughput:"
View 7 Replies
View Related
Nov 15, 2010
I want the get the date of the oldest log in this directory and compare it with current date.Time of the each log can be seen before ".Z" prefix.I have written the following piece of code. However, it is not working for the following case:
LOGDAY=20101129
TODAY= 20101201
Difference is 72, which is not correct, since these are dates.
View 11 Replies
View Related
Mar 9, 2011
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?
View 10 Replies
View Related
May 11, 2011
I am struggling to understand why nawk matches values that are either 1 or 2 digits in length, but not 100 (3 digits).
Am I missing something obvious ? Should I use substr to remove the % ?
I am sure it's something to do with character and string matching behaviour with nawk.
Code:
View 9 Replies
View Related
Dec 15, 2010
I have a program that sends QByteArray datagrams over a udp socket. I would like to have 4 bytes of the datagram that contain a 32 bit integer. When saving numbers to the QByteArray, I have tried the static function number(int) and member function setNum(int), but they convert the integer to its decimal string representation and save that in the byte array. So if the number were 10, it takes 2 bytes, if it were 10,000,000 it takes 8 bytes. This wastes space, and makes it more difficult to get the number when it is packed with a few other pieces of data in the same datagram. Is there a standard way of doing this in Qt?
View 1 Replies
View Related
Dec 30, 2010
If I do:
for i in $(cat names); do seq -f "$i%03.0f" 0 999; done > output5.txt
I got ( tail snipped):
997munt
998munt
999munt
If I do:
for i in $(cat names); do seq -f "%03.0f$i" 0 999; done > output4.txt
I got:
997Zygmunt
998Zygmunt
999Zygmunt
How I can get numbers from 000 to 999 appended like:
Zygmunt997
Zygmunt998
Zygmunt999
View 8 Replies
View Related
Feb 2, 2010
For eg: $NUMBEROFPASSES=6.19 to round up I use NUMBEROFPASSES=$(printf %.0f $NUMBEROFPASSES) What I need to do is round up from eg: 6.10 to be 7 and if lower than 6.10 round down to 6
View 5 Replies
View Related
Mar 19, 2010
I would like to create a small C tool. I encounter a problem of how to make a function to check an input chars contains numbers (started from the second element).
Some samples:
char *mychar= "a3547"; (The result of function checking this is true)
char *another_char = "t6548"; (The result of function checking this is true)
char *next_char = "appl3"; (The result of function checking this is false)
char *new_char = "b1aa3"; (The result of function checking this is false)
View 4 Replies
View Related
Mar 19, 2011
I am trying to generate sequence of number in the order of :
1
2
3
4
[Code]....
View 7 Replies
View Related
Nov 20, 2010
I have a text file with 4 columns and 18 rows. All are integers. I wish to find the average of first 12 numbers in the third column using 'awk'.
View 8 Replies
View Related
Aug 13, 2010
I'm learning c but then when i tried looping as i follow a tutorial, the numbers are wierd that it seems not right..
This is the example.
Quote:
When i run it, it outputs this.
Quote:
why?
View 2 Replies
View Related
Mar 27, 2011
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.
[code]...
View 4 Replies
View Related
May 25, 2010
I have lines in some files that look exactly as below, and the line numbers they occur in are always the same. (Lines 136-139)
W 0.00000000 0.00000000 2.00000000
W 0.50000000 0.50000000 2.50000000
W 0.00000000 0.00000000 3.00000000
[code]...
View 1 Replies
View Related
Jan 26, 2011
Can sed remove non-numerics (apart from an optional leading +) from phone numbers when prefixed with text that must be retained? The need is to make phone numbers exported from an Orage address book to a .ldif file suitable for gnokii to send to a mobile phone. Here are sample lines:
Code:
facsimiletelephonenumber: +91 (123) 1234567
telephoneNumber: +44 (123) 1234567
They have to end up as:
Code:
facsimiletelephonenumber: +911231234567
telephoneNumber: +441231234567
I could do it in awk but am curious to learn if sed can do it.
View 11 Replies
View Related
Nov 2, 2010
I am attempting to "export" the progress bar from wget display using sed. Basically, we have an app that starts wget to download a large file and we want to show a progress bar. Our application has a dbus interface to receive the download progress.
So we were think of a command like:
wget [] | sed [] | dbus-send[]
The problem at the moment is, how do you get the matched string out of sed and into dbus-send? I can get the progress string by:
sed -u 's/[0-9]*%/&/'
This populated '&' with the correct percentage, but I cannot seem to get this out of sed.
View 9 Replies
View Related
Oct 21, 2010
I have a directory with files like this:
Code:
And what I'd like is to have the files renamed like this:
Code:
How could I code it so that it removes the numerical part of the filename (at the beginning), even with different patterns (like the 01 - artist vs the 01-artist)?
View 8 Replies
View Related