Sponsored Content
Top Forums Shell Programming and Scripting Trying to AWK beyond my level Post 302393954 by symphonic1985 on Wednesday 10th of February 2010 04:36:50 AM
Old 02-10-2010
Thanks radoulov and cfajohnson. I've been playing around with your code and I think that I basically have what I need. The first bit of code from radoulov gave me the file structure that I need, but seems to take the 1st 9 records and divide them by 10, then goes in blocks of 10 thereafter, leaving 1 remaining record (for my test file with 100 lines).

I think that the following combination works. Are there any landmines in this that I should watch out for?


Code:
for file  in */resu_*
do 
    _newd=smaller/${file%/*}
    _newn=smaller/$file
    [ -d "$_newd" ] || mkdir -p "$_newd" 

   awk '
   {s1+=$1;s2+=$2}
   !(NR%10){
          {
       print (s1/10,s2/10)
     }
     s1=0; s2=0
   }' "$file"  >  "$_newn"
done

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

need to get to root level

:confused: In the terminal, it shows i am in the I need to get back into root, HOW DO I DO IT!?!?!?! Anyone who can help please do ASAP thanks Confused mac user trying to learn UNIX jimbo:D (2 Replies)
Discussion started by: jhaven007
2 Replies

2. What is on Your Mind?

What level are you?

Just for fun (I'm somewhere between novice and user): (9 Replies)
Discussion started by: RTM
9 Replies

3. Solaris

patch level

Hi, how do you check that the latest service packs/patches are installed on the server, When i look at the OS Modules file, all i see is these numbers like 117176-02 etc, what is currently the latest patch level for sunOS 5.9? thnaks (1 Reply)
Discussion started by: narik007
1 Replies

4. AIX

ML level went backwards?

Hi all. I've been put in charge of updating one of our AIX 5.2 servers to ML7. (perhaps not wise since I'm an absolute n00b, but hey, it's good experience to fly by the seat of one's pants). So: a) I typed "oslevel -r" and got back "5200-04" b) I went to IBM's Fix Central and downloaded... (1 Reply)
Discussion started by: pschlesinger
1 Replies

5. UNIX for Advanced & Expert Users

level 0 dump

need help to create a level 0 dump of the /usr filesystem on the first tape device using compression and then start a level 3 dump of /var after the level 0 completes, is it dump -0ucf /dev/rmt0 /usr (1 Reply)
Discussion started by: jo calamine
1 Replies

6. AIX

maintenance level

Hello I have a question. I have several box with $ oslevel -s 5300-06-01-0000 My questions are: 1.-How long I can keept my actual technology level (in time) before I updated to the next technology level? My other question is If I have to update to the next technology level. ... (2 Replies)
Discussion started by: lo-lp-kl
2 Replies

7. UNIX for Dummies Questions & Answers

OS level backup

I am not a DBA or an unix admin (I am a developer) and I have a question I need clarification for. Recently one of our oracle ebusiness suite server (apps tier, red hat 4) crashed and the unix admin had to rebuild the server. We had backups for the file system under applmgr and oracle. And... (3 Replies)
Discussion started by: bodhi2000
3 Replies

8. Solaris

Difference between run level & init level

what are the major Difference Between run level & init level (2 Replies)
Discussion started by: rajaramrnb
2 Replies

9. Red Hat

SSL certificate generation on OS level or application level

We have a RHEL 5.8 server at the production level and we have a Java application on this server. I know of the SSL certificate generation at the OS (RHEL) level but it is implemented on the Java application by our development team using the Java keytool. My doubt is that is the SSL generation can... (3 Replies)
Discussion started by: RHCE
3 Replies
IO::Async::Signal(3pm)					User Contributed Perl Documentation				    IO::Async::Signal(3pm)

NAME
"IO::Async::Signal" - event callback on receipt of a POSIX signal SYNOPSIS
use IO::Async::Signal; use IO::Async::Loop; my $loop = IO::Async::Loop->new; my $signal = IO::Async::Signal->new( name => "HUP", on_receipt => sub { print "I caught SIGHUP "; }, ); $loop->add( $signal ); $loop->run; DESCRIPTION
This subclass of IO::Async::Notifier invokes its callback when a particular POSIX signal is received. Multiple objects can be added to a "Loop" that all watch for the same signal. The callback functions will all be invoked, in no particular order. EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters: on_receipt Invoked when the signal is received. PARAMETERS
The following named parameters may be passed to "new" or "configure": name => STRING The name of the signal to watch. This should be a bare name like "TERM". Can only be given at construction time. on_receipt => CODE CODE reference for the "on_receipt" event. Once constructed, the "Signal" will need to be added to the "Loop" before it will work. AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::Signal(3pm)
All times are GMT -4. The time now is 11:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy