Search Results

Search: Posts Made By: agama
10,070
Posted By agama
Time service as suggested, or if not available...
Time service as suggested, or if not available maybe running date +%s if your date command on each supports it. That will give seconds since the epoch and you can just do integer compares.

If you...
5,298
Posted By agama
Understood. What I was indicating was that if...
Understood. What I was indicating was that if the subdirectory foo/x.mak exists it will be matched if ./x.mak is used where if \./x.mak is used it will not.

I guess actually both dots in the...
5,298
Posted By agama
A couple of things... First, you should...
A couple of things...

First, you should escape the dot in your pattern so that something like y/x.mak doesn't also match. It might not be a probability in your current directory structure, but...
2,725
Posted By agama
Completely hard coded, but this will work" ...
Completely hard coded, but this will work"


awk '/"lan3"/' file
Forum: HP-UX 05-27-2013
4,135
Posted By agama
That didn't work because you don't need the word...
That didn't work because you don't need the word signal, just pkill -2 inetd


#!/usr/bin/env ksh
# should work with bash too
# usage: scriptname [-][signal-number|signal-name] pattern

if [[...
2,291
Posted By agama
Yes, the "DISPLAY" command should execute and...
Yes, the "DISPLAY" command should execute and pipe it's output to grep. It would help if you could post the whole script, or at least the portions that include the assignment to the DISPLAY variable....
3,554
Posted By agama
Do the records from your log file have a...
Do the records from your log file have a timestamp? If not, it's going to be difficult at best. Would be best to post a sample of the log file with any sensitive information X'd out.
2,006
Posted By agama
The scripts posted earlier in the thread work on...
The scripts posted earlier in the thread work on the original data as input, not what you are giving it. Did you try with the original data? I ran the original data through the two I posted and the...
1,751
Posted By agama
Have you tried reading the data into an array...
Have you tried reading the data into an array which would allow you to avoid the substring overhead which I believe is costing you. Your original code ran in about 4 seconds for me using Bash and...
2,006
Posted By agama
ERK!! I made a change, and tested it, but...
ERK!!

I made a change, and tested it, but failed to see all zeros. Going blind I think.

I've fixed the bug by reverting to my original logic and it works now for me. THANKS!


awk '
...
2,006
Posted By agama
Have a go with either of the programmes below. ...
Have a go with either of the programmes below. If your input file is huge, you may run into issues because these load everything into memory. There are ways to work round those issues, but have a...
2,006
Posted By agama
Assuming your data is in a file named t.data...
Assuming your data is in a file named t.data this is one way:


awk '
/>/ { split( $1, a, ">" ); sect=a[1]; next; }

/Start/ {
s = "";
printf( "%s ", sect );

...
66,158
Posted By agama
I tried in Kshell -- it needed $(( ... )) and...
I tried in Kshell -- it needed $(( ... )) and assumed that bash required the same. My bad for not testing with bash.

Thanks.
66,158
Posted By agama
Even with a #! change, I think something like...
Even with a #! change, I think something like this is needed:


${infile:0:$((len-4))}


as long as bin/sh is a bash or kshell.
968
Posted By agama
You can download it and build it in your home...
You can download it and build it in your home directory -- no need to 'install' it. Of course, company policy might prohibit that too which is too bad.
11,405
Posted By agama
Ah, very good, thanks. Have a go with this: ...
Ah, very good, thanks.

Have a go with this:

awk '
/property name=/ {
gsub( ".*value=" Q, "" );
gsub( Q ".*", "" );
print;
}
' Q="'" RS="[<>]"

...
11,405
Posted By agama
How were you testing it? if you were using echo...
How were you testing it? if you were using echo to echo it and pipe it into awk, were you using double quotes round the whole string? That won't work. Use single quotes:


echo '<property...
11,405
Posted By agama
If you're using a gnu-like awk that supports a...
If you're using a gnu-like awk that supports a record separator pattern, this might work for you:


awk '
/property name=/ {
gsub( ".*value=\"", "" );
gsub( "\".*", "" );
...
968
Posted By agama
If you write your scripts in Kshell, you can use...
If you write your scripts in Kshell, you can use shcomp which will convert the script into a binary representation that Kshell can execute. You then put the executable file out in a public...
1,883
Posted By agama
Try: sed 's/ //' input-file...
Try:


sed 's/ //' input-file >output-file
1,957
Posted By agama
First of all, you don't need to cat into a while,...
First of all, you don't need to cat into a while, you can redirect the file into the while:


while read stuff
do
echo $stuff
done <$ELOG


Further, the use of awk isn't needed either....
1,560
Posted By agama
If you have a modern Korn shell installed, ...
If you have a modern Korn shell installed, ${.sh.file} should contain the name of the file that was sourced.

Have a try with something like this:

#!/usr/bin/env ksh
echo "Running test2.sh...
1,588
Posted By agama
Pipe it through sort. awk ' {...
Pipe it through sort.


awk '
{ a[$1+0] = $0; }
END {
for( x in a )
{
printf( "%s", a[x] );
sc = " ";
for( i = x-10; i <= x + 10;...
1,588
Posted By agama
Assuming no duplicate field 1 values, and that...
Assuming no duplicate field 1 values, and that all will fit in memory this should work:


awk '
{ a[$1+0] = $0; }
END {
for( x in a )
{
printf( "%s", a[x]...
2,211
Posted By agama
Have a go with this: awk ' { ...
Have a go with this:


awk '
{
split( $1, a, ":" );
sum[a[1]] += $NF;
}
END {
for( s in sum )
print s, sum[s];
}
' input-file

...
Showing results 1 to 25 of 500

 
All times are GMT -4. The time now is 07:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy