1 #!/bin/bash 2 3 awk \ 4 'BEGIN { }\ 5 /^\.text/,/DATA_SEG_DEFS_HERE/ { print }\ 6 END { }'\ 7 $1 > temp.awk.1 8 9 awk \ 10 'BEGIN { i = 0; last = "hello" }\ 11 /BLOCK_STRINGS_BEGIN/,/^\.bss/ { if ( i > 1 ) { print last } last = $0; i = i + 1 }\ 12 END { }'\ 13 $1 > temp.awk.2 14 15 awk \ 16 'BEGIN { }\ 17 /DATA_SEG_DEFS_HERE/,/BLOCK_STRINGS_BEGIN/ { print }\ 18 END { }'\ 19 $1 > temp.awk.3 20 21 cp $1 $1.orig 22 cat temp.awk.1 temp.awk.2 temp.awk.3 | sed -e 's/^\.data//' -e 's/^\.bss//' -e 's/^\.text//' > $1 23 /bin/rm -f temp.awk.1 temp.awk.2 temp.awk.3 $1.orig 24