Forum: Shell Scripting 4 Days Ago |
| Replies: 1 Views: 71 Re: Hey Hey There,
You pretty much had it. You just need to backslash the * (multiplication operator) and your script works perfectly :)
#!/bin/bash
for (( i = 1 ; i <= 10; i++ ))
do
#J = 100
... |
Forum: Shell Scripting 4 Days Ago |
| Replies: 1 Views: 72 |
Forum: Shell Scripting 4 Days Ago |
| Replies: 11 Views: 231 |
Forum: Shell Scripting 4 Days Ago |
| Replies: 5 Views: 115 |
Forum: Shell Scripting 5 Days Ago |
| Replies: 11 Views: 231 |
Forum: Shell Scripting 5 Days Ago |
| Replies: 5 Views: 115 |
Forum: Shell Scripting 6 Days Ago |
| Replies: 11 Views: 231 Re: even and odd columsn No problem :)
For this last case, you can just simplify your code and it will give you the output you listed.
{
for(i=3;i<=NF;i++)
{ if(i%2)
printf("%.2f ",$i*100/$1)
else
printf("%.2f ",$i*100/$2) |
Forum: Shell Scripting 6 Days Ago |
| Replies: 5 Views: 115 Re: wildcarding paths Hey there,
Just use the -p option to make dir and it should quit complaining about the directory already existing and do what you want. Also, if you don't need to make those dirs under multiple... |
Forum: Shell Scripting 7 Days Ago |
| Replies: 11 Views: 231 Re: even and odd columsn Hey Again,
As an addendum. If you wanted to pass values from your first awk run to this one, instead of harcoding the variables in the BEGIN block, you could do this instead (note that you're... |
Forum: Shell Scripting 7 Days Ago |
| Replies: 11 Views: 231 Re: even and odd columsn Hey there,
Glad to help - you're stretching my awk-mind - good exercise :)
I would do this to multiply each odd by the total of all odds (and each even by the total of all evens) on each line, like... |
Forum: Shell Scripting 7 Days Ago |
| Replies: 1 Views: 94 Re: weird output Hey there,
I think definitely you'll see some differences in performance. Solaris' sh is the bourne shell and a lot of linux/bsd distro's just like sh to bash or another shell.
The one thing I saw... |
Forum: Shell Scripting 8 Days Ago |
| Replies: 11 Views: 231 Re: even and odd columsn hey there,
Glad I could help out on the last one. For this you can run:
$ awk 'BEGIN{sum1=$1;sum2=$2}{for (i=1;i<=NF;i++) {if ( i%2 ) {sum1 += $i; printf"%.2f ", $i}else {sum2 += $i; printf"%.2f... |
Forum: Shell Scripting 9 Days Ago |
| Replies: 1 Views: 173 Re: opening multiples files in awk? Hey there,
here's a quick, ugly-looking-but-easy-to-understand (I hope ;) bit of shell script. I didn't format the output exactly, but you should be able to do that simply by modifying the end of... |
Forum: Shell Scripting 11 Days Ago |
| Replies: 3 Views: 294 Re: awk percentage problem Thanks :)
I was a little confused by the question, actually ;) What I was working on was the assumption that I had to do, per record, was:
field1/field1+field2 - field2/field1+field2 -... |
Forum: Shell Scripting 15 Days Ago |
| Replies: 3 Views: 294 Re: awk percentage problem Hey there,
Hopefully this will help you out. It also avoids the illegal division by zero and just returns 0 in that condition.
I put your values in a file called "awkpct"
and ran this command |
Forum: Shell Scripting 20 Days Ago |
| Replies: 3 Views: 241 |
Forum: Shell Scripting 20 Days Ago |
| Replies: 10 Views: 670 Re: To force a script to wait for another. Hey there,
To run them in the foreground, as Salem suggested, just remove the trailing ampersand on all your mdadm commands, so:
mdadm --manage /dev/md0 --add /dev/sdb1 &
becomes
mdadm --manage... |
Forum: Shell Scripting 21 Days Ago |
| Replies: 3 Views: 241 |
Forum: Shell Scripting 21 Days Ago |
| Replies: 3 Views: 231 Re: help in shell script Good deal - I was thinking you could recreate that pyramid doing a little less work, if you have "seq" to work with:
#!/bin/bash
cnt=0
while [ $cnt -le 9 ]
do
echo `seq 0 $cnt`
... |
Forum: Shell Scripting 21 Days Ago |
| Replies: 3 Views: 254 |
Forum: Shell Scripting 24 Days Ago |
| Replies: 3 Views: 254 Re: Subject part is not coming while sending mail Hey there,
Depending on what "mail" you're using (revisions, etc), you may be dealing with an issue that is caused by passing the -s "SUBJECT" argument to mail.
If you have it on your system, you... |
Forum: Shell Scripting 28 Days Ago |
| Replies: 7 Views: 420 |
Forum: Shell Scripting 29 Days Ago |
| Replies: 7 Views: 420 Re: fields with spaces I'm in agreement with Salem, run that file through a quick awk statement to parse it into field based on the tabs and see what you get. It might be the answer you're looking for.
If you have space... |
Forum: Shell Scripting 29 Days Ago |
| Replies: 3 Views: 512 |
Forum: Shell Scripting 30 Days Ago |
| Replies: 7 Views: 420 Re: fields with spaces Hey There,
If there's any sort of delimiter at all between the fields (for instance, a colon), you can use awk's -F option, like:
and so forth,
Best wishes, |
Forum: Shell Scripting 33 Days Ago |
| Replies: 3 Views: 547 Re: Maintain the log Hey there,
I would assume it's a representation of a generic compiled java binary.
Best wishes,
Mike |
Forum: Shell Scripting 33 Days Ago |
| Replies: 1 Views: 440 Re: Windows command-line ftp client I'm not sure this is in the right forum, but search your hard drive for the ftp.exe file. If it doesn't run automatically from your command prompt, the directory it's in might not be in your %PATH%... |
Forum: Shell Scripting Oct 11th, 2008 |
| Replies: 5 Views: 828 |
Forum: Shell Scripting Oct 11th, 2008 |
| Replies: 1 Views: 400 |
Forum: Shell Scripting Oct 10th, 2008 |
| Replies: 5 Views: 828 |
Forum: Shell Scripting Oct 9th, 2008 |
| Replies: 5 Views: 828 Re: Avogadro Number Hey there,
Did you want to do some calculation against the constant or just determine if a number is avogadro's number or not? If so, all you have to do is test whether or not the number equals the... |
Forum: Shell Scripting Sep 30th, 2008 |
| Replies: 4 Views: 509 Re: Dynamically-created shell commands Yes,
It would make more sense to just run it in a tmp script. The reason only the echo's work in the "while read" loop is that you're processing one line at a time, and not maintaining state... |
Forum: Shell Scripting Sep 28th, 2008 |
| Replies: 3 Views: 664 |
Forum: Shell Scripting Sep 24th, 2008 |
| Replies: 8 Views: 1,390 Re: help parsing log Hey There,
Maybe something along the lines of:
find /opt/---/---/NodeA/logs/Server_name/ -name "*SystemOut*"|xargs -I var grep -i Timeout "var" /dev/null >DUMPFILE 2>&1
you need the extra... |
Forum: Shell Scripting Sep 16th, 2008 |
| Replies: 3 Views: 762 Re: Script with User inputting file name.. Good work,
I noticed that while I read your first post, but you found that read actually sets the variable for you. Good deal :)
As for replaying, you can either loop by setting a trapping... |
Forum: Shell Scripting Aug 31st, 2008 |
| Replies: 6 Views: 882 Re: Shell Scripting Problem Guess I got mislead by the error message.. :) I'm surprised a script with so many errors didn't generate a much different one other than unexpected EOF ;)
,Mike |
Forum: Shell Scripting Aug 30th, 2008 |
| Replies: 1 Views: 528 Re: copying corresponding language files What sort of backup did you do (ufsdump, netbackup, etc). You should just be able to restore based on a standard base directory and wildcards, like the find you did to get all the German files.
If... |
Forum: Shell Scripting Aug 30th, 2008 |
| Replies: 6 Views: 882 Re: Shell Scripting Problem Good point. Totally looked right past that. There are spaces to the left and right of all the assignment (=) operators... WOW :)
, Mike |
Forum: Shell Scripting Aug 28th, 2008 |
| Replies: 6 Views: 882 Re: Shell Scripting Problem There also seem to be a number of unnecessary backtick characters after a few then and else statements. That could be causing it.
Best wishes,
Mike |
Forum: Shell Scripting Aug 28th, 2008 |
| Replies: 1 Views: 650 |