Programming :: Setting The Final $result
May 18, 2010
I have a variable (call it $valAS) that gets calculated . Also, i have a files Bassu3. if $valAS= 45368 (2nd part of 2nd line in Bassu3) after calculation, then $result=45368, but if $valAS != 45368 then $result= $valAS
Bassu3:
Quote:
name.srv
name 45368 (value always changing)
name 99999
name 88888
how can i do this in Bash?
View 14 Replies
ADVERTISEMENT
Jun 2, 2011
I have a collection of redirect links I need to grab the final domain from (indicated after "->"):
[url]
[url]
I'm thinking PHP/cURL is the way to do it. I've searched the net but failed to find a solution that works for all redirection links.
View 2 Replies
View Related
Dec 2, 2014
How do I generate sql result into xml ? Tried this way (shown below), but it generates all data into single column.
Code: Select allgenerate_xml()
{
f1=_tmp1
f2=_tmp2
cat $SQL_QUERY_OUT |sed -e 's/^"//g;s/"$//g;s/","/|/g'|tr '|' ' ' > $f1
[ -e $SQL_QUERY_OUT ] && rm $SQL_QUERY_OUT
[code]....
View 2 Replies
View Related
Jul 31, 2011
Dear Linux/c++/g++ programmers: the run result on my system, ubuntuLinux10.04(kernel2.6.35-25), gcc4.5.2 is not what book predict
source code
http://examples.oreilly.com/9780596007614/
11-28
11-29
11-24
#include "matrix.hpp"
[Code]...
View 13 Replies
View Related
Aug 5, 2010
I wanted to get the ORACLE_HOME of the listener's running on the server.I have been using the following to get the reult. /opt/oracle/admin/PHYPE/bdump> ps -ef|grep /bin/tnslsnr|grep -v grep|awk '{print $9}'
Result is as follows
/opt/oracle/product/10.2/bin/tnslsnr
/opt/oracle/product/9.2.0/bin/tnslsnr
/opt/oracle/product/10.2/bin/tnslsnr
/opt/oracle/product/10.2/bin/tnslsnr
/opt/oracle/product/9.2.0/bin/tnslsnr
/opt/oracle/product/10.2/bin/tnslsnr
Now i wanted to cut the /bin/tnslsnr part and the remaining should write to the file.
View 4 Replies
View Related
Jan 24, 2010
I'm using the following awk command to find out the users home directory from /etc/passwd file.#grep jeesun /etc/passwd |awk 'BEGIN {FS=":"};{print $6}'But problem is when there are two name like "jeesun" and "jeesunadm" exist the script shows both result not specific one.
View 3 Replies
View Related
Jun 17, 2010
I was wondering if I can show an image on our php site if we store the path to it. For example if we get the result form my sql as:
images/example1.png and the handle the result as common html.
< img src="databaseresult" width="173" height="188" border="1" / >
is this possible? do you think theres a better way to do it?
we need to store the images locally we cant use a blob space on the table.
View 2 Replies
View Related
Jan 29, 2011
It is under PHP/MySQL
$queryresult = $conn->query("INSERT INTO normalrequests VALUES($finalkey, 1234, 5678, FALSE)");
It is connected to the database successfully but I feel there is something wrong with the statement up there.
View 6 Replies
View Related
May 4, 2010
I'm trying to create a program that would locate the oldest file of a certain type on a server. Here's the commands:
OLDEST_PATH=`find -L / -depth -maxdepth 6 -mindepth 6 -type d | sort -f | head -1`
OLDEST_FILE=`find -L $OLDEST_PATH | grep .mp3 | sort -f | head -1`
ls -al $OLDEST_FILE
I'm writing this all in expect but I'm having problems. The main problem I have is whenever I try to run the first command, I can't seem to isolate the result of the OLDEST_PATH so that the 2nd command will work. There always seems to be a newline in the variable and the result is only "find -L" command running and it bypasses the variable. If I can just figure out how to get the 1st and 2nd command to work, then I can figure out the 3rd. Here's some code:
Code:
send "find -L / -depth -maxdepth 6 -mindepth 6 -type d | sort -f | head -1
"
sleep 20
expect -re "(.*)
[Code]....
I know there is a better way to write this. I've tried multiple ways and this just happens to be the last way I've tried it. If you try running this, you'll notice that there is still carriage returns after the result of OLDEST_PATH and it prevents the 2nd "find" command from working properly.
View 2 Replies
View Related
Jan 7, 2010
I am using the script below but need to make it to show the result in a html popup window. The script is Free and I don't think Kristina will complaint by making it more versatile.
The problem I have is that the script moves to a standalone window to show the results. I am interested in making it "popup' a window with the results.
Code:
#!/usr/bin/perl
# NOTE: You must change the line above to point to the path to Perl
# on your system.
#########################################################################
##### AffordaBilly v1.0#
##### Copyright 2001, Kristina L. Pfaff-Harris, scripts@tesol.net#
[Code]....
View 1 Replies
View Related
Jan 11, 2010
I am new to perl and am having trouble adding some strings together.
My full code is below:
The problem is $NewCommandB is always split into two lines, where the second line contains the "/atlas2/<blah>/<etc>/..." string. Since I am generating a .sh file to execute a lot of similar commands I need the string to all be on one line. Any idea why I get this behaviour and any suggestion on how to tell perl to make $NewCommandB a one line string?
Btw for completeness finalFileList.txt contains just file names one line after another:
View 5 Replies
View Related
Oct 17, 2010
I am not sure if this is possible. I have IP's stored in a mysql database. When I query the database, it returns the IP. I would like to replace the IP with something else prior to displaying the results. Is it possible even though I have not stored it in the database?
I have the following in a while loop (mysql_fetch_array).
Code:
<td align="left">' . $row[IP] . '</td>
Instead of displaying $row[IP] from the database, I would like it to display something else which I define in the PHP code but based on the IP.
ie. aaa.bbb.ccc.ddd = hostnameABC
View 4 Replies
View Related
Sep 15, 2010
What i am trying to do is i want to add numbers from 1 to 100. but that too using multiprocessing. So i made a c programme and using fork() command made two child processes. Now in one child process i am adding from 1 to 50. and in another i am adding 51 to 100. and then in the parent process adding the two results to get the final one. Now the result from the two function i am getting correctly. But after the wait() call the value returned is lost : See the programme below for reference
# include<stdio.h>
# include<unistd.h>
# include<sys/wait.h>
# include<stdlib.h>
[code].....
View 6 Replies
View Related
Mar 9, 2010
reading through the documentation for pk2cmd, required for using the PICkit2 programmer. I aim to install using the source, and thus libusb-dev is needed. The docs says that the runtime is usually included with the distro but the dev-part is not. Well, to be on the safe side, I downloaded the source for libusb (0.1.12), which in turn should contain libusb-dev.One step down, a few more to go. pk2cmd should be pretty straightforward to compile, but ...
Now I am asked to set up USB so that it can be used by users other than root. A document is filled to the brim with instruction for cases old and new. It makes my head spin and that's why I am asking. The programmer shows up fine with lsusb,I see it as/dev/bus/usb/001/006So, basically, as I understand it, the device need the proper rights to be used by a regular user. But how do I do that?
View 7 Replies
View Related
Jul 12, 2010
I'm running into a problem when I try to set a variable to an awk output in c-shell. Right now my command is Code: set STR_MSG_TYPE = `awk -F{ '/msg_type/ {print $2}' <filename> | tr -d }'/''*' ` I then run echo to see what the output is and it returns blank, however, when I run the same awk command from the command line, I get an actual output of "MT-715". Am I setting my variable incorrectly? I do something similar using the date command to set a STR_DATE variable earlier in the code and it works fine and I use the same syntax.
View 1 Replies
View Related
Jul 9, 2011
GNU assembler 2.17 (invoked as 'as').
Is there a way of setting no case sensitivity in as?
View 3 Replies
View Related
Jul 11, 2011
how can i set variable by following Quote: >> ./kuku -u a b c d -n ga go gi how can i set variable at tcshell... Quote: user = a b c d num = ga go gi
View 7 Replies
View Related
Aug 16, 2010
I have a configuration file I put ndd commands into for servers settings and I'm running into and issue where they are only off by one character so I keep overwriting the setting.
The file has these two lines in it:
As you can see the only difference is the q0 on the one entry. With the code below I just keep changing/adding a line to the file and not just finding and fixing the each line. I cannot seem to find the right "terminator" for an exact match. I do understand why it's doing it, I just don't know what to do to fix it. What am I missing?
In the end I just want to search this file and make sure these two lines are in there and set properly.
View 3 Replies
View Related
Mar 11, 2010
I'm working on a backup script which takes the following input:
Code:
RevBackup.sh <options> <source> <target>
The problem I'm having is that the source and target might contain spaces in the path. ie. /home/eRJe/My Documents
I would like the script to ignore " " (backslash-space) as being a delimiter. how could I do this without stopping a normal space from being a delimiter?
I could do this with IFS. But so far I have only found info about setting a delimiter and not to "ignore" one
View 4 Replies
View Related
Jun 18, 2011
I am killing myself with this, please someone come to the rescue...
Code:
#!/bin/sh
IFILE=$@
[code]...
View 7 Replies
View Related
Feb 18, 2010
I would like to install PostgreSQL 8.5 from this link [URL], but it complains that it needs rpm-4.6.0 as dependency. It seems that CentOS does not support rpm with version bigger than 4.2.2, or am I wrong?
View 3 Replies
View Related
May 7, 2010
I have the following function, and it appears to set the var correctly, but then tries and executes the line as a command. Anyone know how to keep it from doing that?
PHP Code: SMALL_FILE_PERCENTAGE=88
MEDIUM_FILE_PERCENTAGE=10
LARGE_FILE_PERCENTAGE=2
[code]....
View 1 Replies
View Related
Jul 15, 2010
I am trying to execute executable files in bash without adding ./ I know there must be an alias to add in .bashrc, that must be something like alias PATH=$PATH:. But this seems not to be working.
View 1 Replies
View Related
Apr 24, 2010
I am creating a script for making a public folder in linux. The idea behind is to allow any user to write files in this folder and further each of those files can be used by any user. For this purpose I am using acl. This first requires to set acl as mount option in /etc/fstab which I need to do with help of (awk and sed) command available in linux.
The line below is the fstab entry which I need to make change in.
UUID=e9a3db4b-d8c0-40b4-a661-131e13afea1e
/ext3 relatime,errors=remount-ro 0 1
I want my script to identify this line (most probably with / which denotes the mountpoint) and then add (acl,) without brackets in options. Currently I use the command as below
sed 's/realtime/acl,relatime/' /etc/fstab
but the above command is in reference with (realtime) what I am planning is that my script should be able to find the line which has / and then go to options and add acl there.
View 3 Replies
View Related
May 8, 2010
I have 3 files: main.c, mylib.h, mylib.c Now I want to put mylib.h into : /usr/include/mydir/mylib.h And I create a static library: libmylib.a, and put into the folder: /usr/lib/mydir/libmylib.a Then I compile: $ gcc -o main main.c Then I got linking error
Code:
main.c:(.text+0x3e): undefined reference to `extract_v1'
main.c:(.text+0x7b): undefined reference to `modify_v1'
collect2: ld returned 1 exit status
So I try with -l options: $ gcc -o main main.c -lmylib I still got error
Code:
/usr/bin/ld: cannot find -lmylib
collect2: ld returned 1 exit status
Any idea about this?
Also, I want to ask about: how to create my own header and library to put into /usr/include/mylib/ and /usr/lib/mylib/, so when I use function in my program, the compiler will automatically link to library. It's like when you #include <stdio.h>, and you compile: $ gcc -o program program.c, you don't need to specify any linking folder or library.
View 4 Replies
View Related
Apr 26, 2010
I have this piece of code in my shell script file:
Code:
useradd $UserName; passwd <& $password
I am not able to perform Input Redirection while setting password programatically- without any user intervention.
I think there is a way to do it, but it is just getting slipped from my mind at the moment.
View 2 Replies
View Related
Jan 28, 2010
there is any possibility that I can set in this application an affinity so that the processor binds it to core 2 for instance.Is this possible to do in an application that runs than under root? Or is this just possible after the application started with using the taskset tool?
View 1 Replies
View Related
Jul 13, 2009
Anybody know of any Firefox 3.5 final RPMS for Fedora 10? I looked a rebuilding the Fedora 11 RPMS for Fedora 10, but the other packages requiring an upgrade as well is getting out of control.
View 7 Replies
View Related
Apr 29, 2010
I have RC now, downloaded a week ago. Thinking of re-installing the final one when it's out (very soon!) will there be any difference?
View 9 Replies
View Related
Apr 29, 2010
Does anyone have the torrent url for the final 10.04 LTS? I don't seem to be able to find it......
View 4 Replies
View Related