Ubuntu :: PHP Value Of Variable Put Into A Textfile Using Unix?
Feb 1, 2011How can I put a value of a php variable into a text file. I cant append or write the values into a text file.
View 2 RepliesHow can I put a value of a php variable into a text file. I cant append or write the values into a text file.
View 2 RepliesI have a text file example :
word1
word2
word4
[code]...
Whenever i want to start tomcat server I need to go totomcatdir>inand execute startup.sh file.How would i make this happen whenever i start my machine?Also want to know How would i set the variable at startup.
View 10 Replies View RelatedI have a text file that contains a single word and I want to write a bash script that will read the word from the text file... The following is my incorrect attempt, as it assigns the name of the textfile to the variable as opposed to the word stored within the textfile:(assume I have a text file value.txt that has as its contents a single word, say wordone)
#!/bin/sh
for f in value.txt
do
echo $f
done
so the output of the above script is value.txt, however I want it to be wordone.to summarise: how do I assign the value of the word contained within a textfile to a variable?
need a script to achieve saving multiple text files as 0001 0002 0003 etc.or moving files to a folder displayed this way..there prolly is an " if " statement involved also...if 0001 exist then %+1 and so on.
View 1 Replies View RelatedI have two text files on Linux. One contains a list of valid IDs. E.g:
abcd
efgh
ijkl
etc.
The other contains a list of invalid IDs. But, some of these also appear on the list of valid IDs, in this example "efgh":
mnop
qrst
efgh
etc.
How can I easily construct a text file that contains all the lines from the invalid list that do not appear in the valid list? That is, I want to end up with a text file that has:
mnop
qrst
etc.
I'd like either some Linux commandline magic of some clever Vim trickery.
I use avg free as antivirus scanner. I looked some time for a scanner to scan and remove viruses. Problem is avg 8.5 will only detect viruses, not remove them...I use a oneliner looking like this:
Code:
/usr/bin/avgscan / -x /mnt -x /dev --heur --ignerrors -r /var/log/"scanlog"`eval date +%Y%m%d`".txt"
[code]...
just started with Linux and I'm trying to create new files for each line of my input file. So I have file with 637 lines of data:
2 4 6
2 8 5
3 0 5
etc
and want to create a new file from each line. With
cat name.txt | awk '{ line = $0
print line
}'
I nicely see all lines, but what rests is to save each line separately into new file. I tried While read line command in combination with output >> $.txt, but didn't work well..
i need to calculate the number of words containing letter e in a textfile.
View 9 Replies View Relatedi have been using samba to gain access into windows computer through my pc which has fedora 8 ..can i access the unix machine from another unix machine? is yes then what is the procedures ?
View 4 Replies View RelatedI'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.
For example:
Code:
Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).
how to assign a local variable value to a global variable....
View 2 Replies View Relatedmy script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.
i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't
foo=+12.40
bar=${foo#+}
I am supposed to create an environment variable with the PRINTER variable, which should resolve to the word sales. Would the command be like this?: env PRINTER - NAME=SALES (is this the command to create that variable with resolving the word sales to it?)
View 3 Replies View RelatedI have a text file i that has a mailTo: NAME in it. In a bash script i need to extract NAME and put it in a $variable to use. How do i do this?
View 2 Replies View Relatedhow I can search within a variable and assign the results to a new variable. I'll use the following as an example -
cars="Audi BMW Cadillac Chevy Dodge Ferrari Ford Mercedes"
list=`echo ${cars} | egrep -o '<A?+|<C+'`
with the echo command I get the following output assigned to list -
A
C
C
What I'd like to get for output is -
Audi
Cadillac
Chevy
how I could do this regardless of upper/lower case letters?
included shell script inside c program, and i wanted to assign the value of c variable to shell variable..Can any one please suggest me how to do it?
View 8 Replies View Relatedcan i use the value of one variable to generate a name for another variable? for example i want to use the counter from a "do while" loop to name and define a variable each time the loop executes. for example
objectnames1=`ls -a`
objectnames2=`ls -a`
etc.
i don't have a script yet but each time through the loop i intend to cd to a particular directory and then define a variable containing a list of each object in that directory as values. for the rest of the script to work, each variable generated has to be unique, and i can't think of a good way to accomplish this.
if using a value from one variable to name another isn't possible, can anyone think of a more elegant solution? i know limited syntax but i'm willing to read up...
I am trying to alter the character position of residue numbers above 999 in a pdb file.The following script is an attempt to:1) Get all unique pdb residue numbers (in column 5) using awk and assign it to a variable i.2) Loop through all the values in $i and if it is greater than 999, shift that number one character to the right using sed.However, the script only manages to alter the final residue numberCould anyone please advise how I can loop through all values in $i and shift it one character to the right?
#!/bin/bash
# Script to alter position of residue number in pdb file for resid above 999
i=$(awk '{print $5}' wt-test.pdb | uniq)
[code]...
This loop is part of a bash script which takes multiple arguments.
Code:
for ((i=1;i<=$number;++i)) ; do
offset=$(($i+5))
[code]...
On one of my servers I see this when I log in. What does this mean and how can I get it to go away? Everything seems to work fine, but none of my other machines give this error.
View 5 Replies View RelatedI wonder if the unix commands (cp, mv, grep, args etc) are the same for Mac and Ubuntu. Do they have the same parameter lists and so on or do they try to stay the same but are slightly different?
View 3 Replies View RelatedAfter my first installation/ version of Ubuntu 64, I performed a netstat and noticed I did NOT have any Active UNIX domain sockets as I do now. After doing some research, I found this is related to MYSQL and server services which I am in no need of running and nor do I want to run if not needed. So exactly what are these services used for, which app is creating this and why?
Is it possible to remove the app or processes if they are not needed? Killing these connections every time they attempt to establish would be rhetorical.
~$ uname -a
Linux panda 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:20:59 UTC 2010 x86_64 GNU/Linux
:~$ netstat | more
Active Internet connections (w/o servers)
[Code].....
I was able to ssh to a unix box from my laptop (I generated public and private keys and copied the public keys to the remote machine). Is it normal that I cannot ssh from the unix machine to my laptop? I expected that I could log in from both machines to the other. I am running ubuntu on my laptop and the other machine has redhat.
View 6 Replies View Relatednew hyperaccelerated alternative to unix and windows
View 1 Replies View RelatedI am trying to set up a ssh server on my desktop computer. It runs Ubuntu 10.04 with Win 7 (dual boot). I want to ssh into my desktop from any other machine (from anywhere), and I'm not sure if setting up a ssh server is the right thing to do. Also, is it secure? what kind of encryption does it use
View 5 Replies View RelatedAt the moment I am using Hummingbird Exceed on a windows PC to display X windows from a Unix server. The actual Exceed tool I use is called 'hwm' which I believe is basically an pc based X Windows manager. I do not need to configure anything other than the client computer name, IP address and screen definition and the server will then allow a connection and display the X windows on the client. I was wondering if there is an equivalent application I can run using Ubunto as a client insted of a Windows PC?
View 1 Replies View RelatedOn Windows, you can go to a file's permissions and it's clearly stated who can do what. You can choose between individual users or groups such as 'everyone' or certain types of users such as 'domain users'. You could create a clear cut list of every single user/group on the system and what their permissions for a file are and have it neatly displayed in a list.On Unix, we have octal permissions and sticky bits. I understand the whole concept of rwxrwxrwx (777). The first three are what the file owner can do, the second is what the main group the user belongs to can do, and the third is what other users can do.
But, when you view a file's permissions you are only getting the permissions as they apply to the user that owns the file. For example, as I understand it, if I viewed a file that only the root user had rwx permissions on and everyone else could only read. The permissions would show up as rwxr--r-- (744). But, those same permissions would show up to any user as 744 as well. Since the last 3 characters are what applies to "other users" (pretty vague). How would someone know what users in particular those permissions apply to? There could be one "other user" that can rwx that file and another "other user" that can't.Also, why just stop with the main group? What about other groups? A the user Foo's main group he belongs to might be Foo. But he could also belong to the groups Boo and Zoo, which belong to other users and would give him full rwx permissions over Boo and Zoo's files just as if he were Boo or Zoo.
Then you have the whole sticky bit thing that makes it so that files can be owned by the same person and at the same time be made use of (to varying degrees) by other users. To chmod the UID you'd chmod 2777 or for GID 4777 (just an an example). I did this for a file and it allowed a standard user account who was previously unable to run the command to be able to run it. But, how can that work when I didn't anywhere specify what particular user (or groups of users) that sticky bit applies to?
I'm confused about this whole thing to the point that I'm not even sure exactly what questions I should be asking or even if my examples are even 100% correct. I just sort of ranted about some specific things that floated to the top of my head. Permissions are easy to understand when your running a Unix-like system on a single user desktop. Because the only users/groups you have are root, the single user, and various system users/groups that you don't really need to worry about. So a file with rwxr--r-- means that only the Root user (not even members of his group) can edit the file and you can't unless you use sudo. Because the "other user" in the last 3 characters always just means you. But, things seem to get a whole lot more complicated when you start adding in multiple users. Can someone explain this or link to a "for dummies" article that can explain all of this to me in a way that someone who's used to Windows style permissions can make a connection between the two OS families and their way of handling these things?
Howto mount HTFS (SCO Unix file system) under Ubuntu?
View 3 Replies View RelatedI tried Gnome-ppp but terminal can not find it! Retired can only afford cheap dialup.
Where can I get a version of ubuntu that has system -> administration-> networking?