Below is the content of the file I am parsing
Code:
bash-2.03$ cat rakesh
cpio: Cannot write "reloc/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/gmon.o", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/include/README", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/include/assert.h", errno 28, No space left on device
cpio: Cannot write ", errno 28,
pkgadd: ERROR: attempt to process datastream failed
- process </usr/bin/cpio -icdumD -C 512> failed, exit code 86
pkgadd: ERROR: unable to unpack datastream
Installation of <SMCgcc> failed (internal error).
No changes were made to the system.
Here I set the variable STATUS=5
Code:
bash-2.03$ STATUS=5
then execute this command, where I set the Shell variable STATUS=1
bash-2.03$ cat rakesh | nawk -F"," 'BEGIN{spaceError=0;}{if($2==" errno 28"){system("export STATUS=1");spaceError=1;print $0 ": ERROR"} else {print $0;}}END{if(spaceError==1)system("banner \"No space\"");}'
cpio: Cannot write "reloc/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/gmon.o", errno 28, No space left on device: ERROR
cpio: Cannot write "reloc/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/include/README", errno 28, No space left on device: ERROR
cpio: Cannot write "reloc/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/include/assert.h", errno 28, No space left on device: ERROR
cpio: Cannot write ", errno 28,: ERROR
pkgadd: ERROR: attempt to process datastream failed
- process </usr/bin/cpio -icdumD -C 512> failed, exit code 86
pkgadd: ERROR: unable to unpack datastream
Installation of <SMCgcc> failed (internal error).
No changes were made to the system.
# #
## # #### #### ##### ## #### ######
# # # # # # # # # # # # #
# # # # # #### # # # # # #####
# # # # # # ##### ###### # #
# ## # # # # # # # # # #
# # #### #### # # # #### ######
Check if STATUS got set.
Code:
bash-2.03$ echo $STATUS
5
No
The command system("export STATUS=1"); doesn't seem to work.
I want to chech if STATUS=1, If yes, I want to display a custom error message.
Please help
Thanks