Hi all,
I'm after some help with getting output from what I assume would be the %DATE% and %TIME% variables and manipulating it.
Basically, I want to run a series of command and put it in a file with a timestamp as the file name, like this for example:
output.27Oct05.1606.txt
How would I get...
Hi all,
I have a variable, on some machines it is '1024', which is fine, but on others it is '1024Mb' etc. I need this variable to simply be '1024', does anyone know how I could ensure this is always the case? Perhaps a command to remove any letters/characters that aren't integers if there is...
Hi all,
I need to get rid of the final two characters of a string, eg:
myString='14504'
mymyNewString='145'
If you see what I mean...
The string will be ever changing, so an't just chop out the '04', needs to be the last two characters, any help is greatly appreciated!
Howdy,
I'm developing a system which requires me to run a ksh script from within a cgi script. What sort of syntax will I need to do this, I'm sure it's simple but can't find out how anywhere!
Thanks.
Howdy,
I'm developing a system which requires me to run a ksh script from within a cgi script. What sort of syntax will I need to do this, I'm sure it's simple but can't find out how anywhere!
Thanks.
Hi,
I need to put the single line contents of a file into a variable, but remove the last character, for example the file would have this sort of contents:
2;4;3;10;67;54;96;
And I want the variable to be:
2;4;3;10;67;54;96 (notice the last ";" has gone).
Unfortunately I can't...
Hi all,
I have a file with several columns of data, eg:
A B C D
--- --- --- ---
1 2 5 1
2 2 2 2
8 4 4 4
4 2 3 4
10 9 4 4
9 7 1 2
I need to get the values from, say, column B and place them into a string separated by a semicolon, eg:
2;2;4;2;9;7
Does...
Hey guys, I'm designing a site. I can get these commands to work, but never all together! Eg I wish to have a blue button to start with, which changes red onMouseover, then changes to a new button when clicked, then back to the original. Any Ideas?
Much appreciated.
Hey all,
We have a small desktop PC running RedHat 8. This works fine, but we had major performance probs due to swap being on the same HD. We added a second HD, and would like to put swap on this disk only, but can't find an option in the RedHat OS to specify where to put a swap area. Does...
No problem guys, got it! In case anyone needs to know, you can just bung the variable into a temp file and do a
wc -m ${TEMPFILE}
which gives you the total characters in the file. Ta anyways.
Hi,
I have a script which takes a value from a file and performs calculations on it. Trouble is that this value is a float not an integer and it errors at the decimal point!
eg. 94.62
I would like to be able to detect the length of the float (in this above case, 5 characters), and simply do a...
You could simply say:
if (( $DAY_OF_YR < 100 )) then
DAY_OF_YR=$DAY_OF_YR|cut -c2-3
if (( $DAY_OF_YR < 10 )) then
DAY_OF_YR=$DAY_OF_YR|cut -c3
fi
fi
It's a bit of a phaffy way around it, but it (or something like it) will work.
I have a problem I don't understand... I am trying to declare a variable, and then output the results of that variable, couldn't be simpler
#!/bin/ksh
VAR='Oranges'
if [ ${VAR}='Lemons' ]
then
echo "Found Lemons"
elif [ ${VAR}='Oranges' ]
then
echo "Found Oranges"...
Hi,
In UNIX, the sar -c command gives you the number of system calls initiated in the last x minutes. The same command on Linux gives totally different info. Are there any packages/add ons, or does anyone know the command to get system calls in Linux? Thanks.
Hi all,
With Sar, it gives you the CPU usage for the last x minutes etc, does anyone know if this is an average value when the machine in question has multiple CPU's, or simply just a reading of CPU #1?
Ta.
Hi,
I need to place a line of text into a file at a certain point, and I have been using:
sed '
/theWord/ {
atheNewLine
}' < sourceFile > newFile
This works a treat, trouble is that it adds theNewLine underneath EVERY occurrence of lines containing theWord. Does anyone know a way to simply...
Hi,
I need to insert a line into a file underneath an existing line in the file, but am unsure as to the syntax. I'm pretty sure sed can be used though, although any ideas are more than welcome. For example:
File
----
Line 1
Line 2
Line 3
Line 4
Line 6
I need to say: Insert...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.