User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 455,996 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,817 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Showing results 1 to 40 of 302
Search took 0.02 seconds.
Posts Made By: eggi
Forum: Shell Scripting 4 Days Ago
Replies: 1
Hey
Views: 71
Posted By eggi
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
Posted By eggi
Re: Please i need help in UNIX Shell Scripting..

Hey there,

What have you got so far? Perhaps I can help you out by working with you on where your script is breaking down.

Best wishes,

Mike
Forum: Shell Scripting 4 Days Ago
Replies: 11
Views: 231
Posted By eggi
Re: even and odd columsn

:) My pleasure.

Good luck to you,

Mike
Forum: Shell Scripting 4 Days Ago
Replies: 5
Views: 115
Posted By eggi
Re: wildcarding paths

:) Happy to help

Mike
Forum: Shell Scripting 5 Days Ago
Replies: 11
Views: 231
Posted By eggi
Re: even and odd columsn

No problem,

Glad to help out - plus I get to learn, too :)

Best wishes,

Mike
Forum: Shell Scripting 5 Days Ago
Replies: 5
Views: 115
Posted By eggi
Re: wildcarding paths

You got it :)

Just add that to the end and you're set!

, Mike
Forum: Shell Scripting 6 Days Ago
Replies: 11
Views: 231
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
Re: ok now i have a problem with merging two arrays

Cool :)

Glad to be of some help :)

, Mike
Forum: Shell Scripting 20 Days Ago
Replies: 10
Views: 670
Posted By eggi
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
Posted By eggi
Re: ok now i have a problem with merging two arrays

Hey There,

check out this page for just about everythign you might need to know about bash arrays (at least, a lot of the basics ;) - This part addresses your issue, but the whole page is...
Forum: Shell Scripting 21 Days Ago
Replies: 3
Views: 231
Posted By eggi
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
Posted By eggi
Re: Subject part is not coming while sending mail

Good deal!

Glad I could help :)

, Mike
Forum: Shell Scripting 24 Days Ago
Replies: 3
Views: 254
Posted By eggi
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
Posted By eggi
Re: fields with spaces

cool :)

Glad to help out in whatever capacity I did ;)

, Mike
Forum: Shell Scripting 29 Days Ago
Replies: 7
Views: 420
Posted By eggi
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
Posted By eggi
Re: How to delete the First 3 characters from File-name using unix command

Hey there,

If you want to do these en masse, you can either cd to the directory, or use a full path name and then apply that code generically to all the files in a for loop, while loop or using...
Forum: Shell Scripting 30 Days Ago
Replies: 7
Views: 420
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
Re: Avogadro Number

No problem. Glad to help :)

, Mike
Forum: Shell Scripting Oct 11th, 2008
Replies: 1
Views: 400
Posted By eggi
Re: Downloading attachments from an email through a shell script.

Hey There,

Check out either uuencode/uudecode (for uuencoded attachments) or the freely available mpack/munpack binaries, for MIME attachments.

Best wishes,

Mike
Forum: Shell Scripting Oct 10th, 2008
Replies: 5
Views: 828
Posted By eggi
Re: Avogadro Number

Hey There,

Here's one way to do it:



Output:
Forum: Shell Scripting Oct 9th, 2008
Replies: 5
Views: 828
Posted By eggi
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
Posted By eggi
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
Posted By eggi
Re: hi, shell /awk for getting echo the linenumber from log file

Hey there,

The above comment is absolutely correct; just thought this might help a bit.

If you want to print out the line numbers on your matches just print NR within awk, like



or, since you...
Forum: Shell Scripting Sep 24th, 2008
Replies: 8
Views: 1,390
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
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
Posted By eggi
Re: set -x -> putting log into a file other than stderr

Hey There,

I don't know if this is trivial - I couldn't find anything that specifically addressed it, but the easiest way I can think of would be to do a double run:

bash -x script 2>&1|grep "^+"...
Showing results 1 to 40 of 302

 
All times are GMT -4. The time now is 9:42 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC