Search Results

Showing results 1 to 40 of 53
Search took 0.03 seconds.
Search: Posts Made By: Aia ; Forum: Shell Scripting and child forums
Forum: Shell Scripting 15 Days Ago
Replies: 1
Views: 342
Posted By Aia
isxrc> PLS PLS PLS can someone help. I have 24 hours from now and the clock is ticking.
The urgency is on your part, not on ours. You have chosen to fail already.
Read the rules of the forum. We do...
Forum: Shell Scripting 22 Days Ago
Replies: 4
Views: 440
Posted By Aia
stat might give you what you want.
Forum: Shell Scripting 26 Days Ago
Replies: 7
Views: 920
Posted By Aia
Drop the use of grep in this case, since it is not necessary.
sed 's/OUT.*$/IN/g' < original_file > result_file
Forum: Shell Scripting 28 Days Ago
Replies: 14
Views: 1,071
Posted By Aia
If you want to continue using awk as the workhorse, then:
ls -l f3.sh | awk '{ if( NF > 7 ) { split($7, a, ":"); print a[1] } }'
Forum: Shell Scripting 30 Days Ago
Replies: 14
Views: 1,071
Posted By Aia
As you have been shown you can pipe the ls command to another program that further parses the output, in this case awk.
awk can do a lot of things, but even in its simplest form it can be very...
Forum: Shell Scripting 30 Days Ago
Replies: 14
Views: 1,071
Posted By Aia
Look into the command touch
Forum: Shell Scripting 30 Days Ago
Replies: 11
Views: 1,135
Posted By Aia
if ( ${cnt} -ge "1" ) That reads if cnt is greater or equal to 1 therefore != would have not worked.

if ($cnt >= 1) then
# whatever you want to mail
endif
Forum: Shell Scripting 31 Days Ago
Replies: 11
Views: 1,135
Posted By Aia
csh doesn't use if/fi but rather if/endif. Look at posted script and you'll see you have an if/fi.
BTW csh doesn't have the same conditional operators than bash so -ge doesn't work.
Forum: Shell Scripting Nov 11th, 2009
Replies: 11
Views: 1,135
Posted By Aia
Post your code the way you wrote it to execute. Make sure there's a space between [ and ]
Forum: Shell Scripting Nov 11th, 2009
Replies: 4
Views: 617
Posted By Aia
Find any difference between both and then match it. e.g. with HOOK by itself in a line we can match the beginning and end of the line. Thus:
grep '^HOOK$' file_name
Once you have down the...
Forum: Shell Scripting Nov 11th, 2009
Replies: 5
Views: 728
Posted By Aia
It makes a difference the quotation scheme.
sed "/$npname.*in/d" parts.txt > parts.tmp
Forum: Shell Scripting Nov 11th, 2009
Replies: 3
Views: 614
Posted By Aia
What's the trouble?
In its simplest form, create another executable script with three lines of text, where each line is the absolute path to those three scripts.
Forum: Shell Scripting Oct 25th, 2009
Replies: 3
Views: 698
Posted By Aia
Your logic for including the matching pattern escapes me, however I can explain it to you.
This '$1 ~/^#/' tells awk to search for any line that in the first field the beginning of the line starts...
Forum: Shell Scripting Oct 17th, 2009
Replies: 2
Views: 878
Posted By Aia
sed -e "s/$old_string/$new_string/" file1.txt > file2.txt
Forum: Shell Scripting May 27th, 2009
Replies: 4
Views: 1,125
Posted By Aia
blackrobe> Can you please give me an example on how to use the "sed" command in this case??...

I can do better than that, I will give you a link to an easy to understand tutorial...
Forum: Shell Scripting May 24th, 2009
Replies: 1
Views: 647
Posted By Aia
Arguments are parameters you pass to functions. Or referring to the command line is what you enter in the shell.
Assuming you have a script that needs two arguments when you run it at the command...
Forum: Shell Scripting Apr 19th, 2009
Replies: 10
Views: 1,180
Posted By Aia
I am afraid that command doesn't produce the advertised result.
Forum: Shell Scripting Apr 19th, 2009
Replies: 10
Views: 1,180
Posted By Aia
>Anyway, one more favor, care to explain
It would require a base understanding that would take some time to write. Fortunately, others has done it already. Take a look at this link...
Forum: Shell Scripting Apr 18th, 2009
Replies: 1
Views: 757
Posted By Aia
Maybe (http://www.linuxquestions.org/questions/programming-9/bash-programming-create-a-menu-307345/)?
Forum: Shell Scripting Apr 12th, 2009
Replies: 5
Views: 997
Posted By Aia
Continue to troubleshoot it, manually first, before creating a batch file.
In the current directory make a file that contain the y character alone.
In the current directory create another...
Forum: Shell Scripting Apr 10th, 2009
Replies: 5
Views: 997
Posted By Aia
>the code is running but it i not deleting files.
I'm skeptic that this script runs properly. To start kiran.txt is in the same current directory that you are trying to delete *everything*.
And...
Forum: Shell Scripting Apr 9th, 2009
Replies: 10
Views: 1,180
Posted By Aia
>But, I'll still look for that [one-liner].
Because originally you used the switch -i I assumed your version of sed was GNU.
Thus sed -ie "0,/$JOBNAMES/{//d;}" filename should have work.
However,...
Forum: Shell Scripting Apr 8th, 2009
Replies: 10
Views: 1,180
Posted By Aia
Instead of :
sed -ie "\|^$JOBNAME\$|d"

try:
sed -ie "0,/$JOBNAMES/{//d;}" filename

The workhorse bit is "0,/RE/". It looks from starting line until first occurrence of REGEX

>I really am...
Forum: Shell Scripting Apr 5th, 2009
Replies: 2
Views: 812
Posted By Aia
Your script doesn't make any sense, however I am going to guess some.
If you want to itinerate through the array ids you are missing something
for ((i=0;i<${#ids[@]};i++)); do



That...
Forum: Shell Scripting Mar 25th, 2009
Replies: 4
Views: 1,051
Posted By Aia
>I wrote the solution in awk using substr() :


A slightly different approach. Since the targets to compare are found always in the beginning, use only the first field. Separate individual...
Forum: Shell Scripting Mar 24th, 2009
Replies: 11
Solved: turn mb to gb!
Views: 1,622
Posted By Aia
>any ideas?
I am not running any version of Solaris so I don't know what's the "gotcha."
But if sprintf() is doing the job after the suffix "GB" is erased, let's do it.
Make an awk file that...
Forum: Shell Scripting Mar 20th, 2009
Replies: 11
Solved: turn mb to gb!
Views: 1,622
Posted By Aia
>So sprint if getting the values however they still have either MB or GB on the end so therefore the sprintf statement wouldnt work would it?

Yes, it would. sprintf() tries to read and convert any...
Forum: Shell Scripting Mar 20th, 2009
Replies: 2
Views: 879
Posted By Aia
>Why the variable $number is losing its value outside while loop
even though it's a global value?

It has to do with the pipe

Read here...
Forum: Shell Scripting Mar 20th, 2009
Replies: 11
Solved: turn mb to gb!
Views: 1,622
Posted By Aia
You get that result because sprintf is not receiving any value in column $2 that can convert into a decimal.
For debugging purposes substitute every line with a sprintf() call for just a print of $2...
Forum: Shell Scripting Mar 19th, 2009
Replies: 11
Solved: turn mb to gb!
Views: 1,622
Posted By Aia
Assuming data format:


For example purposes coming from datafile to awk and displaying to standard output. Modify to need.

awk '/s/ {
if ( index($2, "GB") ) {
$2 =...
Forum: Shell Scripting Mar 18th, 2009
Replies: 4
Views: 1,216
Posted By Aia
Try this and see if you can figure out:

echo "2.3 4.56789" | awk '{printf "%.2f %.2f\n", $1, $2}'
Forum: Shell Scripting Feb 10th, 2009
Replies: 9
Views: 1,211
Posted By Aia
>What does the e+11 and e+10 mean??
Search for scientific notation. When a number is large in length (very big or very small), a method has been invented to represent it using exponent.
Forum: Shell Scripting Feb 9th, 2009
Replies: 4
Views: 794
Posted By Aia
>Basically, I want to know why the second script returns the line:
>Total size of files containing foo is: 0

Variable scope (http://www.nucleardonkey.net/blog/2007/08/variable_scope_in_bash.html)...
Forum: Shell Scripting Jan 26th, 2009
Replies: 7
Solved: awk print total
Views: 2,157
Posted By Aia
John, Manager, Finance, $2000
Jack, Accountant, Finance, $1500

If you take off the $ sign from the field value it might work.

[Edit] Don't disregard Salem's advice. You're lucky I didn't...
Forum: Shell Scripting Jan 24th, 2009
Replies: 9
Views: 1,211
Posted By Aia
result=$(echo $var1 $var2 | awk '{print $1 - $2}')
$1 inside awk becomes whatever variable you past first, and $2 becomes the second variable and so on.
More about awk...
Forum: Shell Scripting Jan 24th, 2009
Replies: 9
Views: 1,211
Posted By Aia
>That gives me the following error
Yeap, expr doesn't support floating points
In bash you'll need to use bc, calc, awk, or perl
But ksh-93 supports floating points
result=$(((($obyte2 - $obyte1)...
Forum: Shell Scripting Jan 23rd, 2009
Replies: 9
Views: 1,211
Posted By Aia
Variables in the shell are strings. Another utility is necessary to make the evaluation.
expr can do it, but has many "gotchas" that you need to be aware of, e.i. spaces, (), *, which need to be...
Forum: Shell Scripting Jan 20th, 2009
Replies: 4
Views: 1,506
Posted By Aia
Whenever you log-in or open a new terminal window that starts the shell to run, a series of scripts are executed to establish the environment in which it is to run. These scripts contains commands...
Forum: Shell Scripting Jan 16th, 2009
Replies: 4
Views: 1,080
Posted By Aia
Segmented, so you can understand better.
The first ^ says match beginning of a line.
The [^=] says match any character that is not a = sign. (the ^ inside [] is different that the one for the...
Forum: Shell Scripting Jan 16th, 2009
Replies: 4
Views: 1,080
Posted By Aia
echo $1 | sed -e "s/^[^=]*=\(.*\)$/\1/"
echo $1 is the argument from the shell piped to sed but it doesn't have any thing to do with \1


What's \1? The first group remembered from the original...
Showing results 1 to 40 of 53

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC