Forum: Shell Scripting Aug 5th, 2009 |
| Replies: 12 Views: 5,697 |
Forum: Shell Scripting Jul 10th, 2009 |
| Replies: 3 Views: 589 Yes, it can. A simplistic way to find all affected files, leaving you to do the rest of the work:find / -type f -exec grep -li viagra {} \;
Or, assuming you are on a reasonably POSIX-ish system, a... |
Forum: Shell Scripting Jun 18th, 2009 |
| Replies: 4 Views: 665 That's what happens when you've been looking at the problem too long. I'm going through the same thing now on my own project ('updating' Smoothwall Express to use LFS 6.4). Boy am I overlooking stuff... |
Forum: Shell Scripting Jun 17th, 2009 |
| Replies: 4 Views: 665 Adding a sub() statement to your awk code that deletes the % from the df() output should work. The above syntax should work on your system (AIX & Pains or Solaris?); I'm still using a 1988 version of... |
Forum: Shell Scripting Jun 17th, 2009 |
| Replies: 5 Views: 711 Generally speaking, one would first catalog all available CLI programs on the router and see if one of them approximates the perl functionality. Specifically in this instance, netcat might do the... |
Forum: Shell Scripting Jun 17th, 2009 |
| Replies: 5 Views: 854 A box character is one that Windows and other systems render as a box because that character does not have a glyph defined.
To the OP: you need to identify exactly which character is being... |
Forum: Shell Scripting May 28th, 2009 |
| Replies: 4 Views: 875 OK. Tar is weirder than I thought. If GNU tar is called as 'tar cv /usr/local/bin', it will create a tar archive on STDOUT, seemingly in violation of the man page. Called as you indicated in your... |
Forum: Shell Scripting May 28th, 2009 |
| Replies: 4 Views: 875 No. Double-check the man page. You'll see the 'f' option requires a value, specifically the name of the destination tar is to use. (UNlike many commands, tar doesn't require that 'f's value follow it... |
Forum: Shell Scripting May 22nd, 2009 |
| Replies: 5 Views: 845 Check your ed script. I'll bet there is at least one space at the beginning of most of the lines, which happens when one copy/pastes from a web browser.
The ed() commands should be at the... |
Forum: Shell Scripting May 15th, 2009 |
| Replies: 16 Views: 5,528 This may be starting to get ugle and specific to Linux or Posix version of certain tools. The following seem to work:
# Comment out the entry
crontab -l | \
egrep -m 3 -v "^# DO NOT EDIT THIS... |
Forum: Shell Scripting May 12th, 2009 |
| Replies: 8 Views: 824 Each of your -exec clauses needs to be terminated with an escaped semi-colon, as in:
find / -name \*JPG -exec chmod 644 {} \; -print
At least the shell and possibly find() are having... |
Forum: Shell Scripting May 11th, 2009 |
| Replies: 2 Views: 605 Weird, but it can be done.
CUST_1=filename
b=1
eval c=\$CUST_$b
echo $c
There may be easier ways to do what you mean, like using an array. But this works, and gets points for being... |
Forum: Shell Scripting Apr 22nd, 2009 |
| Replies: 3 Views: 30,500 To actually answer your query, you need to feed the commands you want to execute to su(), as in:su -c "./configure --with-redhat" - vpopmail
You can execute the commands one at a time, or you can... |
Forum: Shell Scripting Apr 7th, 2009 |
| Replies: 11 Views: 1,110 These two scripts use the HTML files from the web site, as they are better formatted than the text. The shell script fetches the .htm file if it hasn't already fetched it and filters the htm through... |
Forum: Shell Scripting Apr 6th, 2009 |
| Replies: 2 Views: 804 1. You mixed metaphors, so to speak. As Aia said, you cannot (easily) mix shell variables with awk. While gawk does allow you to import shell var values using the -v option, you still won't get what... |
Forum: Shell Scripting Apr 6th, 2009 |
| Replies: 11 Views: 1,110 Ah. The data are not exactly normalized. That is, each entry does not necessarily meet the 'ALL CAPS' requirement. They're generally ALL CAPS, but some are terminated with space, some with comma,... |
Forum: Shell Scripting Apr 6th, 2009 |
| Replies: 11 Views: 1,110 Try the following two files, an awk script and a sh script. Put them both in the same working directory.
Put your text into lawdict.txt and ensure it conforms to the one requirement: that all of... |
Forum: Shell Scripting Apr 6th, 2009 |
| Replies: 11 Views: 1,110 I think it would be easier to write the shell script to generate SQL output directly so you can 'source' that SQL file right into your database via phpmysqladmin.
Are all of the CAPITALS... |
Forum: Shell Scripting Mar 23rd, 2009 |
| Replies: 4 Views: 1,009 You seem to be right; awk/gawk do seem to have limited REs.
But I do have a wiseacre solution. :)
alias awk=egrep
awk "^.(.)\1" emp.list |
Forum: Shell Scripting Mar 23rd, 2009 |
| Replies: 3 Views: 524 Why's it work?
Matter inside double quotes (") is interpreted/evaluated by the shell. Matter inside single quotes (') is not.
It's a handy tool, but can cause some stubbed toes along the way. :) |
Forum: Shell Scripting Mar 19th, 2009 |
| Replies: 4 Views: 1,181 /usr/ucb/ps -auxxx | awk '{printf("%4s %4s %5s %4s %s\n", $3,$4,$2,$1,$11)}' | grep -v 0.0probably does what you really want: line up the columns. If you truly want the numbers to be %5.2f format,... |
Forum: Shell Scripting Mar 12th, 2009 |
| Replies: 4 Views: 1,431 mysql -u ...
if [ $? -eq 0 ]; then
echo "Success"
else
echo "Failure"
fi |
Forum: Shell Scripting Mar 11th, 2009 |
| Replies: 16 Views: 5,528 Of course it won't work now. You changed the watchdog line in crontab from */5 * * * */opt/watchdog/startwatchdog.sh as you originally specified, to /5 * * * * /opt/watchdog/startupWatchdog.sh
You... |
Forum: Shell Scripting Mar 11th, 2009 |
| Replies: 4 Views: 1,431 To misquote an old TV show, "Of course it's possible; don't be ridiculous." :) And it's really trivial.
You could try something like:mysql -u username -e 'insert into TableB select col1,col2 from... |
Forum: Shell Scripting Mar 11th, 2009 |
| Replies: 16 Views: 5,528 Forty lashes with a wet noodle for me for posting the wrong thing. The code above should work now; I've reduced it to a single line. This time I actually tested them. :$
It appears you don't have... |
Forum: Shell Scripting Mar 7th, 2009 |
| Replies: 3 Views: 565 Perhaps the '!' and the '[' should be swapped. Usually the 'not' works better if it's part of the test. :) Of course, shell scripting has become somewhat, mmm, different in the past 20 years, so it... |
Forum: Shell Scripting Mar 7th, 2009 |
| Replies: 6 Views: 1,116 In shell programming, ensuring that arguments are properly quoted is an exercise left to the user who must either escape spaces in the search phrase or put quotes around the search phrase.
... |
Forum: Shell Scripting Jan 19th, 2009 |
| Replies: 3 Views: 645 Without the backslash, the shell checks to see if there is an alias for the command. If so, it uses it.
With the backslash, the shell skips this check and runs the first version of the command... |
Forum: Shell Scripting Jan 19th, 2009 |
| Replies: 2 Views: 1,276 One way to do it is to put $c after the variable you are reading. Of course, then you have to change the rest of your code to deal with these vars.
Another way to do it is use use arrays, which... |
Forum: Shell Scripting Jan 9th, 2009 |
| Replies: 16 Views: 5,528 First, it assumes that the editor you are using to edit the crontab is vi(). If you've 'export EDITOR=vi' in the script, then this should be OK.
It is feeding vi() commands to the 'crontab -e'... |
Forum: Shell Scripting Jan 9th, 2009 |
| Replies: 16 Views: 5,528 The following should do the trick quite easily.
To comment out the line:
crontab -l >/tmp/crontab.a
sed -e 's=\(^.*/opt/watchdog/startwatchdog.sh$\)=#\1' /tmp/crontab.a | crontab
rm... |
Forum: Shell Scripting Jan 2nd, 2009 |
| Replies: 8 Views: 6,277 The only thing I can think to try is to find exactly where the .bat file is created and remove 'DELETE' privilege from that directory for all users (via Properties, Security tab and Advanced button.... |
Forum: Shell Scripting Dec 30th, 2008 |
| Replies: 12 Views: 1,411 Not all previous answers were exactly correct. You can edit a file in-place.
Here's some semi-advanced shell scripting. It demonstrates reading from the terminal in a loop deleting 'dangerous'... |
Forum: Shell Scripting Dec 24th, 2008 |
| Replies: 3 Views: 1,079 A slightly different way. Just blindly create all the directories in the path and check the command's return code for success or failure. It's not exactly what you posted, but does serve to... |
Forum: Shell Scripting Dec 12th, 2008 |
| Replies: 6 Views: 1,315 bc(1) is your friend. It computes to arbitrary precision.
"-e" tells bash to interpret \x sequences; ksh might not need it.
.
.
.
integer read=`echo -e "scale=2\n$rBytes/1000000" |... |
Forum: Shell Scripting Dec 4th, 2008 |
| Replies: 10 Views: 2,422 The following may be closer to what you want:
lsof | grep QuarkXP \
| cut -c76- \
| sort | uniq \
| awk '{ printf("\"%s\"\n", $0)}' > /tmp/output1
The cut(1) deletes... |
Forum: Shell Scripting Jul 7th, 2008 |
| Replies: 12 Views: 5,697 Of course it is possible. Don't be ridiculous.
Sorry, I couldn't resist stealing a line from an old TV sitcom.
On a GNU system, the following script should work.
#!/bin/bash
... |
Forum: Shell Scripting Aug 24th, 2007 |
| Replies: 12 Views: 5,697 Try the following. It now 'moves' the file into the ZIP, verifies the integrity of the new archive, and it creates the ZIP file in the destination directory.
#!/bin/bash
... |
Forum: Shell Scripting Aug 24th, 2007 |
| Replies: 12 Views: 5,697 should be:
for files in `ls *.dem`; do |
Forum: Shell Scripting Aug 23rd, 2007 |
| Replies: 2 Views: 3,514 And an example using sed and shell. It can be put on one line also, but I broke it up for readability:
sed -e 's/.*HOST *= *//' -e 's/ *).*//' inputfile.txt | (
typeset -i i; i=1
while read... |