Skip to main content
edited body
Source Link
mug896
  • 1k
  • 10
  • 12

This is another awk version.

awk -f- <<\EOF data
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        FS=","
        while ( getline > 0 ) {
            $1=$1
if ( $0 ~ /Variables:/ ) break
      if ( $0 ~ /Variables:/ ) break$1=$1
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF

This is another awk version.

awk -f- <<\EOF data
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        FS=","
        while ( getline > 0 ) {
            $1=$1
            if ( $0 ~ /Variables:/ ) break
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF

This is another awk version.

awk -f- <<\EOF data
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        FS=","
        while ( getline > 0 ) {
            if ( $0 ~ /Variables:/ ) break
            $1=$1
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF
added 34 characters in body
Source Link
mug896
  • 1k
  • 10
  • 12

This is another awk version.

awk -f- <<\EOF FS="," datafiledata
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        FS=","
        while ( getline > 0 ) {
            $1=$1
            if ( $0 ~ /Variables:/ ) break
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF

This is another awk version.

awk -f- <<\EOF FS="," datafile
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        while ( getline > 0 ) {
            if ( $0 ~ /Variables:/ ) break
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF

This is another awk version.

awk -f- <<\EOF data
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        FS=","
        while ( getline > 0 ) {
            $1=$1
            if ( $0 ~ /Variables:/ ) break
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF
added 8 characters in body
Source Link
mug896
  • 1k
  • 10
  • 12

This is another awk version.

awk -f- <<\EOF FS="," datafile
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        while ( getline > 0 ) {
            if ( $0 ~ /Variables:/ ) break
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF

This is another awk version.

awk -f- <<\EOF FS="," datafile
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        while ( getline ) {
            if ( $0 ~ /Variables:/ ) break
            print $0 > f
        }
        FS="="
        while ( getline ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF

This is another awk version.

awk -f- <<\EOF FS="," datafile
    FNR==1 { f = FILENAME".new" }
    /Final structure in terms of initial Z-matrix:/ {
        while ( getline > 0 ) {
            if ( $0 ~ /Variables:/ ) break
            print $0 > f
        }
        FS="="
        while ( getline > 0 ) {
            if( NF == 2 ) {
                printf "%-5s%15.8f\n", $1, $2 > f
            } else {
                break
            }
        }
    }
EOF
deleted 24 characters in body
Source Link
mug896
  • 1k
  • 10
  • 12
Loading
Post Undeleted by mug896
Post Deleted by mug896
Source Link
mug896
  • 1k
  • 10
  • 12
Loading