file close how 2 
Author Message
 file close how 2

#!/bin/csh -f
# this one-liner works real good:

        /begin/ , /end/   $msg_name >   "file_out"      \

# we are trying to awk out a bunch of jpg and gif files
# from the net gathered up using uqwk off-line news reader
#
# the problem ==> "file_out" is one big file with multiple
# images in it
# the folowing piece of code look like it will work
# produces multiple file names
#       but the  { close (file_out      FAILES
# and we either get nothing or another big file.

 set            msg_name = test
 /bin/awk '                                                     \
                { line[NR] = $0 }                               \
 $1 == "begin" { print  "uu_file_" NR   }                       \
 $1 == "begin" { file_out =  "uu_file_" NR      }               \
 $1 == "begin" { close (file_out =  "uu_file_" NR)      }       \
 { print  $1            >> "file_out"   }                       \
         '     $msg_name

# ? how do you structure the close ( 4 lines up from here?

Thank You
danw



Tue, 29 Feb 2000 03:00:00 GMT  
 file close how 2


|#!/bin/csh -f

Yeuch.

Basically, you are trying to split a file containing multiple uuencoded
files into its constituent parts, right? Something like

#!/bin/awk -f
/^begin/ { file_out = $2 ".uu" }
{ print >> file_out }
/^end/ {
    close (file_out)
    file_out = "/dev/null"

Quote:
}

should work. Untested, but you get the gist. Note that the order of the
awk statements is important.

                        Pete

|# this one-liner works real good:
|
|        /begin/ , /end/   $msg_name >   "file_out"      \
|
|# we are trying to awk out a bunch of jpg and gif files
|# from the net gathered up using uqwk off-line news reader
|#
|# the problem ==> "file_out" is one big file with multiple
|# images in it
|# the folowing piece of code look like it will work
|# produces multiple file names
|#       but the  { close (file_out      FAILES
|# and we either get nothing or another big file.
|
| set            msg_name = test
| /bin/awk '                                                     \
|                { line[NR] = $0 }                               \
| $1 == "begin" { print  "uu_file_" NR   }                       \
| $1 == "begin" { file_out =  "uu_file_" NR      }               \
| $1 == "begin" { close (file_out =  "uu_file_" NR)      }       \
| { print  $1            >> "file_out"   }                       \
|         '     $msg_name
|
|# ? how do you structure the close ( 4 lines up from here?
|
|
|Thank You
|danw

--

PO Box 220, Whiteknights, Reading, | Phone: +44-118-9875123 ext 7594
Berkshire, RG6 6AF, United Kingdom | Fax:   +44-118-9750203                
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WWW: http://www.rdg.ac.uk/~spr96phh/pete.html Use lynx - you know you want to!



Tue, 29 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MF Cobol File Locks,ATomic File Close/Delt

2. file close examples wanted

3. File/close disabled in 2003

4. ABC File closes when window lose focus

5. ABC File Close Error

6. File Closing problem

7. Strange thing: file.close did not show error but work wrong

8. file closing

9. file.close()

10. IOError on file close

11. File closing

 

 
Powered by phpBB® Forum Software