159 Posted Topics
Re: Would SELinux help in this case? Here's an old post from the fedora mailing list that might help: [url]http://www.redhat.com/archives/fedora-selinux-list/2004-October/msg00125.html[/url] | |
Re: Not knowing much about your system, it's nearly impossible for us to tell what effect deleting that file might have. That being said, if that file is (was?) indeed a *core dump*, then losing it is probably not a problem. Core files are full of diagnostic information written to disk … | |
Re: Hi Staric! I see a couple of potential issues here. I think the real answer lies in your "mirror" command. I'm not familiar with a 'mirror' command, so is it safe to assume that's a script? Could you paste that script here as well? If the problem is that it's … | |
Re: Hello voidyman! I'm not sure about kicking off a process via FTP, but if you have cron access you might get better results running a shell script from cron that checks for that file, and does the work if it exists. | |
Re: For the second problem, you can use re.search, with a fairly simple regex. Something like this should do: [engi]{4} That will match a lot of words that don't have ALL four of those letters though. You can probably refine it form there if needed. | |
Re: Hello! You may want to try using "MM" in your date string to represent the month, rather that "mm" which represents minutes ;) [code]SimpleDateFormat("dd-MM-yyyy")[/code] From the java documentation: [code]M Month in year Month July; Jul; 07 m Minute in hour Number 30[/code] | |
Re: Hello perly! It looks like you're close! Since you didn't post what you perceive as the problem is with your script, I'm just guessing as to the solution here :) Why not do it all line-by-line though? Something like this might work: [code] my $REPORT_FILE = 'report.txt'; my $allRfile = … | |
Re: Hi Shwick! "I tried adding in a www entry but it only resolves to the same local ip as example.com" ^This is the expected behavior here. On the web server side of things, you would want to make sure that apache (or your web server of choice) resolves both example.com … | |
![]() | Re: Hello Who?! Does something like this help? [code]<?php // set $a to house here: $a = "house"; // set $c to the php code we want, using // $a as a variable: $c = "<?php \$b = \"$a\"; ?>"; // echo $c to see what out output looks like! echo … ![]() |
Re: Hello jam2010, welcome to the forum! Could you show us what you have tried so far? We might be able to help you get it to work, but I don't know that anyone here will write a script to spec from scratch. Thanks! -G | |
Re: Hi Sudo! I've done something similar before to monitor a log for errors, and execute commands based on what it found. Here's an example: [code]#!/bin/bash logfile="/var/log/messages" pattern="ERROR.*xxx" tail -fn0 $logfile | while read line ; do echo "$line" | grep "$pattern" if [ $? = 0 ]; then echo "$line" … | |
Re: That's interesting! If you can run that from the command line, it *should* work in a script as well... Perhaps try using the full path to 'java' and the full path to the Test.jar? | |
Re: rsync! Do some thing like [icode]rsync -av --delete-after /home/folder1/subfolder/ /home/folder2/subfolder[/icode]. I *think* that will do what you're looking for! | |
Re: Hi k2k! Were you able to figure this out? Personally I've found that using keys for authentication is much more reliable (and possibly more secure?) than using passwords in scripting tasks like this. Is that an option in your case? | |
Re: k2k, This sounds similar to what you're asking in your other thread. So you want to match the line TWO down from the first match instead of the one directly below? Will there ever be an 'a=0' between them? like this: #this is y a=0 a=0 where you would want … | |
Re: Hi techie929, I *think* that you are getting an empty file because you are opening the file with ">", which will create a file if one does not exist, or *truncate* the file if it does exist. Therefore, the file is being truncated before you even get to read it … | |
Re: Hi Member24! It looks like you're running into this feature of awk output redirection: [quote] print items > output-file This type of redirection prints the items into the output file output-file. The file name output-file can be any expression. Its value is changed to a string and then used as … | |
Re: Hello Watery! Why not just use a simple regex to match the pattern you're looking for? This one works for me, but you might be able to simplify it even more: [code] open FILE, "sample.txt" or die $!; while (<FILE>) { if ( $_ =~ /(http:\/\/www\..*?)\// ) { print $1 … | |
Re: griswolf beat me to it :) | |
Re: Hi! Have you looked at File::Copy? This link has information about the File::Copy module, and some examples: [url]http://perldoc.perl.org/File/Copy.html[/url] I hope this helps! | |
Re: Hi amithlaxman! Have you looked into the [url=http://perldoc.perl.org/functions/fork.html]fork()[/url] function? | |
Re: Hi tmparisi! Perhaps you could show us what you've tried so far? Generally FTP requires some interaction, so you might be better off using something like Perl, depending on what you're trying to do, but there's still a lot that can be done in bash! | |
Re: Would re.sub work for what you're doing? [url]http://www.regular-expressions.info/python.html[/url] Something like this? [code] #!/usr/bin/python import re import fileinput for line in fileinput.input("test.txt"): print re.sub("(APP[a-z]{2}[0-9]{3})", "<a href=\"\\1\">\\1</a>", line) [/code] Here's a test run: [code] -> cat test.txt APPsd222 APPxx333 -> python test.py <a href="APPsd222">APPsd222</a> <a href="APPxx333">APPxx333</a> [/code] I hope this helps! I'm … | |
Re: Hi SakuraPink! Sounds like you're making progress! The 'p' at the end is for 'print'. Take a look at the [url=http://unixhelp.ed.ac.uk/CGI/man-cgi?sed]sed man page[/url] for more info about that. If you're using these sed lines in a similar way to your original script, that would explain why the second file is … | |
Re: Hi _neo_! Just to be sure, can you tell us what language you're working with? There are a couple of ways this might be accomplished, but I wanted to be sure I'm testing with the correct base syntax file first. Thanks! -G | |
Re: Hello yli! Are you trying to replace values or strings? In your example, you're using str_replace() which gives us interesting results. For instance: "portocala" becomes "portoc<b>ala</b>" For THIS example, I'll assume that's what you're expecting! :) You can replace your new_kw/old_kw logic with a simple loop, which will loop through … ![]() | |
Re: Hello machine91! Take a look at python's "csv" module. I believe it will give you what you need. I'm a python noob, but here's a basic example that does something close to what I think you're looking for: [code] #!/usr/bin/python import csv csvInput = csv.reader(open('test.txt', 'rb'), delimiter=' ') count = … | |
Re: Hello Sid! I don't think there's a way to accomplish this with pure PHP. If cron is available on the server (if it's a unix/linux system, or task scheduler if it's Windows), that's probably the way to go. I hope this helps! -G | |
Re: Hi all! This can be done with a fairly simple one-liner! As Salem pointed out, all the clues are in the man page, but I personally found the solution in 'sort' rather than 'uniq': [code] # The test file with your sample data -> cat test.txt REF | FOR | … | |
Re: Hello anjoz! 'readlink -f' will give you the full path to a filename, but I'm not sure how to overcome the issue of storing those in a text file if there's more than one file with the same name. I think a better solution might be to either store the … | |
Re: Hello Diwakar Gana! I'm not 100% sure of the answer, but it looks like there is a related discussion over at perlmonks: [url]http://www.perlmonks.org/?node_id=839304[/url] I hope this helps! -G | |
Re: Hi Freude! The ">" basically just re-directs output. In this case, the result of: [icode] echo "pause 1; replot; reread;" > loop_forever.gnu [/icode] would be a file named 'loop_forever.gnu' with the stuff in quotes as the content of the file. It looks like .gnu is an extension to indicate that … | |
Re: Hello santhoshvkumar! I do not believe that there is a way to run a bash command from inside MySQL. What you MIGHT be able to do though is run a bash script from cron that will check for a flag in mysql, and act based on that. I hope this … | |
Re: Hi! The Linux Documentation Project is one way to start: [URL="http://tldp.org"]http://tldp.org[/URL] There's a good introduction to Linux here: [URL="http://tldp.org/LDP/intro-linux/html/index.html"]http://tldp.org/LDP/intro-linux/html/index.html[/URL] There are lots of places to go from there. My best advice is to just install it and find something that you want to do with it. Configuring and maintaining a … | |
Re: Whizkid: I think we might need more context... If I had to guess, "CheckRetStat" is probably a function, defined elsewhere in the script. verdascofernan: I'm not sure what you mean, but it doesn't appear to be related to this thread, so you might have better luck starting a new thread … | |
Re: Hi fuggles! I'm not sure what you mean by "Live USB", but take a look at "unetbootin" [url]http://unetbootin.sourceforge.net/[/url] You should be able to use unetbootin to get a bootable USB image from the dvd iso. I hope this helps! -G | |
Re: You could always just echo the command before it's run, then run it. You could even put a prompt in there if you really wanted. [code]#!/bin/sh prompt="<<root@server ~>>$ " for command in "ls" "cd /tmp" "ls"; do echo "$prompt $command" $command done[/code] Sample output: [code]$ sh tmp.sh <<root@server ~>>$ ls … | |
Re: Hi wapcrimers, There isn't reall an "uninstall" for Linux. How was it installed on this machine? Is it on a separate disk or partition? It also might help to know what kind of problem you are experiencing. Based on the information you've provided so far, all we can really do … | |
Re: Hmm... I'm not familiar with the 'nlst' command. What happens if you use 'ls' instead? For me, 'ls' gives me a directory listing, neatly stored in @filenames. | |
Re: Hi kukuruku! I believe you're looking for this: [icode]$#argv[/icode] Check out this link for more details! [url]http://www-cs.canisius.edu/ONLINESTUFF/UNIX/shellprogramming.html[/url] I hope this helps! -G | |
Re: This sounds interesting Kavitha! What have you tried so far? Do you have any example text so that we can see what the log looks like? I worked on something similar recently, but I didn't go as far as getting the entire stack trace (that part might be a little … | |
Re: Hi suman.great! Here's a line from the 'expr' man page that relates to the problem that you're having: [icode]Beware that many operators need to be escaped or quoted for shells.[/icode] You can work around this simply by quoting your variables. I tested this with your sample data and this script: … | |
Re: Expect is definitely the way to go... OR you could generate a list of files first (store them in a variable or temporary file), and use ncftpput to do the work, no expect or << required! | |
Re: Hi madtorahtut! Have you tried [URL="http://www.samba.org/rsync/"]rsync[/URL]? Rsync does exactly what you're describing, with a very simple command line. Here's an example... If you want to have /data/ on Server A sync'd with /data/ on Server B (deleted files are deleted, changed files are changed, etc...) you would do something like … | |
Re: Awk would be great for this too, especially if the message is in the same 'field' every time. For instance, in your example text, your 'short_message' is in the second field (after the first comma). Something like this would do the trick: [icode]awk -F, '/short_message/ {split ($2,A,"="); print A[2]}'[/icode] In … | |
Re: This post is 2 days old, so I hope this helps... There are some commands that are actually made for this! Try "host" or "nslookup". Your results will be much faster and easier to parse than ping. -G | |
Re: Hi Vasu! That certainly sounds possible. I think we might need a little more information though. Perhaps some sample data, and which columns you want to get these values from? | |
| |
Re: Hi Moncky, This is something I've been interested in too, and until recently there hasn't been any real "standard" to go by. With as much RAM as you can get into a machine these days, the recommended swap size varies wildly depending on how the machine will be used. After … | |
Re: Is that output from 'who'? It looks more like the 'w' command. The only problem with the straight sed approach above is that you're going to end up with a lot more commas than you expect. You probably don't want commas in the "WHAT" column between commands and arguments and … |
The End.