Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31

Thread: Bash Script outputs to text file But it's not in alphabetical order?

  1. #21
    Join Date
    Jan 2011
    Beans
    52

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    Quote Originally Posted by Vaphell View Post
    no idea if these work, i have no flac collection so i tested this only on few sample files found on the internet

    flac_info.sh
    Code:
    #!/bin/bash
    
    shopt -s nullglob
    while (( $# ))
    do
      [ -d "$1" ] && dirs+=( "$1" )
      shift
    done
    mflac=( --no-filename --show-tag=ARTIST --show-tag=ALBUM --show-tag=TITLE --show-tag=REPLAYGAIN_ALBUM_GAIN --show-tag=REPLAYGAIN_TRACK_GAIN )
    
    
    while IFS= read -rd $'\0' dr
    do
      files=( "$dr"/*.flac )
      [ ${#files[@]} -eq 0 ] && continue
      for f in "${files[@]}"
      do
        metaflac "${mflac[@]}" "$f"
        echo "-----"
      done
    done < <( find "${dirs[@]}" -type d -print0 )
    gain.awk (should be executable)
    Code:
    #!/usr/bin/awk -f
    
            BEGIN { FS="[ =]"; ag=1000; tg=1000; }
        /ARTIST=/ { a=$0; }
         /TITLE=/ { t=$0; }
         /ALBUM=/ { al=$0; }
    /ALBUM_GAIN=/ { ag=$2; }
    /TRACK_GAIN=/ { tg=$2; }
           /----/ {
                    if( ag<x || tg<x )
                    { 
                      print a; print t; print al;
                      printf("track gain: %s, album gain: %s\n", tg, ag);
                      print "---------";
                    }
                    a=""; t=""; al=""; ag=1000; tg=1000;
              }
    Code:
    ./flac_info.sh /media/Storage/Music /some/other/dir > some.file
    ./gain.awk -v x=-4 some.file
    or in 1 line
    Code:
    ./flac_info.sh /media/Storage/Music | ./gain.awk -v x=-4
    i think the 1st method is better because you can dump data about the whole music collection to file once and then only work with that file without running everything again and again.
    Hello Vaphell,

    And thank you again for the reply. I will give this new code you just sent a try. I have been trying to get the script I have now to do what I want and I am nearly there but for the life of me I can't get it to print the info I want. Here is a snippet of what my script with your previous code inserted is producing:

    /media/Storage/Music/Rock/Fleetwood Mac - Discography Lite/2007 - English Rose - Beat Goes On Records BGOCD750 GB (12 FLAC files)
    Tag Values Retrieved:
    REPLAYGAIN_TRACK_GAIN=-8.87 dB
    REPLAYGAIN_TRACK_GAIN=-9.53 dB
    REPLAYGAIN_TRACK_GAIN=-10.57 dB
    REPLAYGAIN_TRACK_GAIN=-8.58 dB
    REPLAYGAIN_TRACK_GAIN=-10.34 dB

    And another snippet of the same dump:
    /media/Storage/Music/Rock/Joan Baez - Various Albums @320kbps/1995-11 - Diamonds & Rust - Mobile Fidelity Sound Lab UDCD 646 US (11 FLAC files)
    Tag Values Retrieved:
    album=Diamonds & Rust
    title=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust
    album=Diamonds & Rust

    So as you can see it's not very consistent.

    And here is a snippet of my script without your code to search the replaygain values:

    Tag Values Retrieved:
    artist=Fleetwood Mac
    title=Emerald Eyes
    REPLAYGAIN_TRACK_GAIN=-2.42 dB
    REPLAYGAIN_ALBUM_GAIN=-2.42 dB
    artist=Fleetwood Mac
    title=Believe Me
    REPLAYGAIN_TRACK_GAIN=-2.74 dB
    REPLAYGAIN_ALBUM_GAIN=-2.74 dB
    artist=Fleetwood Mac
    title=Just Crazy Love
    REPLAYGAIN_TRACK_GAIN=-3.30 dB
    REPLAYGAIN_ALBUM_GAIN=-3.30 dB
    artist=Fleetwood Mac
    title=Hypnotized
    REPLAYGAIN_TRACK_GAIN=-3.03 dB
    REPLAYGAIN_ALBUM_GAIN=-3.03 dB
    artist=Fleetwood Mac
    title=Forever

    I am pretty sure the problem lies in the awk part of the script. Something not letting it throw the info I need to the log or on the other side throwing too much info to the log, but as you are aware, I am not a coder so I guess that assumption is a wild guess. Anyway, thanks for the extra help and the new code. I will give it a try and post back.

    Cheers,

    Singtoh
    Last edited by Singtoh; November 29th, 2012 at 06:22 AM. Reason: spelling and clarity

  2. #22
    Join Date
    Jan 2011
    Beans
    52

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    Quote Originally Posted by Vaphell View Post
    no idea if these work, i have no flac collection so i tested this only on few sample files found on the internet

    flac_info.sh
    Code:
    #!/bin/bash
    
    shopt -s nullglob
    while (( $# ))
    do
      [ -d "$1" ] && dirs+=( "$1" )
      shift
    done
    mflac=( --no-filename --show-tag=ARTIST --show-tag=ALBUM --show-tag=TITLE --show-tag=REPLAYGAIN_ALBUM_GAIN --show-tag=REPLAYGAIN_TRACK_GAIN )
    
    
    while IFS= read -rd $'\0' dr
    do
      files=( "$dr"/*.flac )
      [ ${#files[@]} -eq 0 ] && continue
      for f in "${files[@]}"
      do
        metaflac "${mflac[@]}" "$f"
        echo "-----"
      done
    done < <( find "${dirs[@]}" -type d -print0 )
    gain.awk (should be executable)
    Code:
    #!/usr/bin/awk -f
    
            BEGIN { FS="[ =]"; ag=1000; tg=1000; }
        /ARTIST=/ { a=$0; }
         /TITLE=/ { t=$0; }
         /ALBUM=/ { al=$0; }
    /ALBUM_GAIN=/ { ag=$2; }
    /TRACK_GAIN=/ { tg=$2; }
           /----/ {
                    if( ag<x || tg<x )
                    { 
                      print a; print t; print al;
                      printf("track gain: %s, album gain: %s\n", tg, ag);
                      print "---------";
                    }
                    a=""; t=""; al=""; ag=1000; tg=1000;
              }
    Code:
    ./flac_info.sh /media/Storage/Music /some/other/dir > some.file
    ./gain.awk -v x=-4 some.file
    or in 1 line
    Code:
    ./flac_info.sh /media/Storage/Music | ./gain.awk -v x=-4
    i think the 1st method is better because you can dump data about the whole music collection to file once and then only work with that file without running everything again and again.
    Hello Vaphell,

    At the risk of sounding like a complete bonehead The first script flac_info.sh runs perfectly and outputs exactly the info I need in the correct format, but I don't see where to adjust the gain so it only outputs the "the less than -XdB values." The gain.awk runs in the terminal but I only see this:

    track gain: -11.51, album gain: -11.51
    ---------



    track gain: -10.54, album gain: -10.54
    ---------



    track gain: -10.28, album gain: -10.28
    ---------



    track gain: -10.05, album gain: -10.05
    ---------
    this was run at -10 to save time. So I ran gain.awk in terminal like this:
    ./gain.awk -v x=-10 rgainvaluesMUSIC.log > rgainvaluesFAIL.log and it outputs a log with the same values as above only the track gain: -10.28, album gain: -10.28 values are logged with no ARTIST,ALBUM, ect. ect. ect. ect. . So I assume that gain.awk calls the log "rgainvaluesMUSIC.log" and does it's work, and outputs in this case "rgainvaluesFAIL.log"?? So if that is correct(assuming I am not a complete bonehead) then there is still a problem of sorts. Please sort me out if I am running this incorrectly?? Cheers Vaphell for your help and patience.

    Singtoh

  3. #23
    Join Date
    Jan 2011
    Beans
    52

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    Quote Originally Posted by Vaphell View Post
    no idea if these work, i have no flac collection so i tested this only on few sample files found on the internet

    flac_info.sh
    Code:
    #!/bin/bash
    
    shopt -s nullglob
    while (( $# ))
    do
      [ -d "$1" ] && dirs+=( "$1" )
      shift
    done
    mflac=( --no-filename --show-tag=ARTIST --show-tag=ALBUM --show-tag=TITLE --show-tag=REPLAYGAIN_ALBUM_GAIN --show-tag=REPLAYGAIN_TRACK_GAIN )
    
    
    while IFS= read -rd $'\0' dr
    do
      files=( "$dr"/*.flac )
      [ ${#files[@]} -eq 0 ] && continue
      for f in "${files[@]}"
      do
        metaflac "${mflac[@]}" "$f"
        echo "-----"
      done
    done < <( find "${dirs[@]}" -type d -print0 )
    gain.awk (should be executable)
    Code:
    #!/usr/bin/awk -f
    
            BEGIN { FS="[ =]"; ag=1000; tg=1000; }
        /ARTIST=/ { a=$0; }
         /TITLE=/ { t=$0; }
         /ALBUM=/ { al=$0; }
    /ALBUM_GAIN=/ { ag=$2; }
    /TRACK_GAIN=/ { tg=$2; }
           /----/ {
                    if( ag<x || tg<x )
                    { 
                      print a; print t; print al;
                      printf("track gain: %s, album gain: %s\n", tg, ag);
                      print "---------";
                    }
                    a=""; t=""; al=""; ag=1000; tg=1000;
              }
    Code:
    ./flac_info.sh /media/Storage/Music /some/other/dir > some.file
    ./gain.awk -v x=-4 some.file
    or in 1 line
    Code:
    ./flac_info.sh /media/Storage/Music | ./gain.awk -v x=-4
    i think the 1st method is better because you can dump data about the whole music collection to file once and then only work with that file without running everything again and again.
    Hello Vaphell,

    I see how this is supposed to work I think. I'm a bit slow in my old age, forgive me.

    So i run this from terminal: ./flac_info.sh /media/Storage/Music /home/patrick > rgainFAIL.log ./gain.awk -v x=-4 rgainFAIL.log and it runs on thru nicely and if I assume correctly the gain.awk is supposed to process the rgainFAIL.log to only log anything below -4dB?? If that is correct then the gain.awk part isn't working yet??. The log goes into my home as it should and in a nice clean perfect format for my needs but, it seems that it is not being processed by the gain.awk because the full list of replaygain values is still there from +3dB to -11dB. So, I am probably doing something wrong somewhere or it's not yet working correctly?? Don't know Vaphell, sorry for all the back and forth, I'm getting a headache again.

    Cheers,

    Singtoh

  4. #24
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,366
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    paste example from the log file that is supposed to be filtered out yet it gets through

    i compare both album gain and track gain (album gain < -4 will make the info to be printed out too) and you probably want only track gain tested?
    if that's the case, this is the line you want to modify
    Code:
    /----/ {
             if( ag<x || tg<x )
             {
               ...
             }
    if ( album_gain < threshold ) OR ( track_gain < threshold ) { print stuff }, throw away album gain part and ||
    Last edited by Vaphell; November 29th, 2012 at 08:05 PM.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  5. #25
    Join Date
    Jan 2011
    Beans
    52

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    Quote Originally Posted by Vaphell View Post
    paste example from the log file that is supposed to be filtered out yet it gets through

    i compare both album gain and track gain (album gain < -4 will make the info to be printed out too) and you probably want only track gain tested?
    if that's the case, this is the line you want to modify
    Code:
    /----/ {
             if( ag<x || tg<x )
             {
               ...
             }
    if ( album_gain < threshold ) OR ( track_gain < threshold ) { print stuff }, throw away album gain part and ||
    Hello Vaphell,

    This is what flac_info.sh produces:

    artist=The Doobie Brothers
    album=Stampede
    title=Sweet Maxine
    REPLAYGAIN_ALBUM_GAIN=-1.68 dB
    REPLAYGAIN_TRACK_GAIN=-1.68 dB
    -----
    artist=The Doobie Brothers
    album=Stampede
    title=Neal's Fandango
    REPLAYGAIN_ALBUM_GAIN=+0.79 dB
    REPLAYGAIN_TRACK_GAIN=+0.79 dB
    -----
    artist=The Doobie Brothers
    album=Stampede
    title=Texas Lullaby
    REPLAYGAIN_ALBUM_GAIN=-0.84 dB
    REPLAYGAIN_TRACK_GAIN=-0.84 dB
    -----
    artist=The Doobie Brothers
    album=Stampede
    title=Music Man
    REPLAYGAIN_ALBUM_GAIN=-1.61 dB
    REPLAYGAIN_TRACK_GAIN=-1.61 dB

    Which is perfect for my needs except that it is not filtered by gain.awk. And this is the output after running gain.awk on that same log file. I ran the first snippet at -10 and the second at -7 and it does what it's suppose to do perfectly, except it doesn't output all the info as you can see :

    run at @ -10
    ---------



    track gain: -10.06, album gain: -10.06
    ---------



    track gain: -11.48, album gain: -11.48
    ---------



    track gain: -10.70, album gain: -10.70
    ---------



    track gain: -10.30, album gain: -10.30
    ---------



    track gain: -11.45, album gain: -11.45
    ---------

    run @ -7
    -----------------------------------------------------------------------------------------------------------------------------------

    track gain: -4.98, album gain: -7.05
    ---------



    track gain: -6.36, album gain: -7.05
    ---------



    track gain: -7.75, album gain: -7.75
    ---------



    track gain: -8.34, album gain: -8.34
    ---------



    track gain: -8.62, album gain: -8.62

    And here is my attempt to make it output the same as the first snippet but only filtered, and I have failed miserably I just can't get it, it seems I might be close but it denies me joy every time And you are correct, I really only need ALBUM_GAIN, ARTIST, TITLE, and ALBUM to be filtered output, But TRACK_GAIN being included is just fine as well, kind of a bonus I guess.

    -7.57
    -7.57
    ARTIST=
    TITLE=
    ALBUM=
    TRACK_GAIN=-7.57
    ALBUM_GAIN=-7.57
    -----------------------------------------------------------------------------------------



    -8.43
    -8.43
    ARTIST=
    TITLE=
    ALBUM=
    TRACK_GAIN=-8.43
    ALBUM_GAIN=-8.43
    -----------------------------------------------------------------------------------------

    Thanks Vaphell, I will try that new bit of code now and post back with the results.

    Cheers,

    Singtoh
    Last edited by Singtoh; November 29th, 2012 at 11:37 PM. Reason: added info for clarity

  6. #26
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,366
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    in the output album=, title= and artist= are lowercase?
    then make them lowercase as well in awk.
    /pattern/ { ... } means "if line matches /pattern/, do { ... }"
    apparently /TITLE=/ doesn't trigger when it looks at "title=..."

    or make the test case insensitive so it works with "title=..." and "TITLE=..."

    Code:
    ...
        toupper($0) ~ /ARTIST=/ { a=$0; }
         toupper($0) ~ /TITLE=/ { t=$0; }
         toupper($0) ~ /ALBUM=/ { al=$0; }
    toupper($0) ~ /ALBUM_GAIN=/ { ag=$2; }
    toupper($0) ~ /TRACK_GAIN=/ { tg=$2; }
    ...
    Last edited by Vaphell; November 30th, 2012 at 12:00 AM.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  7. #27
    Join Date
    Jan 2011
    Beans
    52

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    Quote Originally Posted by Vaphell View Post
    in the output album=, title= and artist= are lowercase?
    then make them lowercase as well in awk.
    /pattern/ { ... } means "if line matches /pattern/, do { ... }"
    apparently /TITLE=/ doesn't trigger when it looks at "title=..."

    or make the test case insensitive so it works with "title=..." and "TITLE=..."

    Code:
    ...
        toupper($0) ~ /ARTIST=/ { a=$0; }
         toupper($0) ~ /TITLE=/ { t=$0; }
         toupper($0) ~ /ALBUM=/ { al=$0; }
    toupper($0) ~ /ALBUM_GAIN=/ { ag=$2; }
    toupper($0) ~ /TRACK_GAIN=/ { tg=$2; }
    ...
    Hello Vaphell,

    Running this:

    flac_info.sh /media/Storage/Music /home/patrick > rgainvalueMUSIC.log outputs this:

    artist=Eric Clapton
    album=Back Home
    title=Say What You Will
    REPLAYGAIN_ALBUM_GAIN=-9.09 dB
    REPLAYGAIN_TRACK_GAIN=-8.51 dB
    -----
    artist=Eric Clapton
    album=Back Home
    title=I'm Going Left
    REPLAYGAIN_ALBUM_GAIN=-9.09 dB
    REPLAYGAIN_TRACK_GAIN=-10.31 dB
    -----
    artist=Eric Clapton
    album=Back Home
    title=Love Don't Love Nobody
    REPLAYGAIN_ALBUM_GAIN=-9.09 dB
    REPLAYGAIN_TRACK_GAIN=-8.09 dB

    which is true and correct and in the same exact format as what is stored in the replaygain tags in the flac files.

    Running this:

    gain.awk -v x=-4 rgainvalueMUSIC.log > rgainvalueMUSIC1.log after changing the capitalization
    Code:
    /artist=/ { a=$0; }
        /title=/ { t=$0; }
        /album=/ { al=$0; }
        /album_gain=/ { ag=$2; }
        /track_gain=/ { tg=$2; }
    outputs this:

    artist=Doobie Brothers, The
    title=Ordinary Man
    album=Sibling Rivalry
    track gain: -7.68, album gain: -8.97
    ---------
    artist=Doobie Brothers, The
    title=Jericho
    album=Sibling Rivalry
    track gain: -8.46, album gain: -8.97
    ---------
    artist=Doobie Brothers, The
    title=On Every Corner
    album=Sibling Rivalry
    track gain: -7.77, album gain: -8.97
    ---------
    artist=Doobie Brothers, The
    title=Angels Of Madness
    album=Sibling Rivalry
    track gain: -8.65, album gain: -8.97

    which is perfect for my needs but it no longer filters, please see below.

    So the capitalization was part of the problem and by changing that, it outputs what is required, but it no longer filters the below -4, -5, -10, -15(at -11 thru minus infinity it should output nothing) whatever number I put in there. It just strictly outputs the same values as above with the same artist and values over and over But you nailed the capitilization part nicely Don't know what to do??

    Cheers,

    Singtoh
    Last edited by Singtoh; November 30th, 2012 at 01:25 AM. Reason: edited for clarity

  8. #28
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,366
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    file with dummy data:
    Code:
    artist=AAA
    album=AAA
    title=AAA
    REPLAYGAIN_ALBUM_GAIN=-5.09 dB
    REPLAYGAIN_TRACK_GAIN=-5.51 dB
    -----
    artist=BBB
    album=BBB
    title=BBB
    REPLAYGAIN_ALBUM_GAIN=-6.09 dB
    REPLAYGAIN_TRACK_GAIN=-6.31 dB
    -----
    artist=CCC
    album=CCC
    title=CCC
    REPLAYGAIN_ALBUM_GAIN=-7.09 dB
    REPLAYGAIN_TRACK_GAIN=-7.09 dB
    -----
    artist=DDD
    album=DDD
    title=DDD
    REPLAYGAIN_ALBUM_GAIN=-8.09 dB
    REPLAYGAIN_TRACK_GAIN=-8.09 dB
    -----
    artist=EEE
    album=EEE
    title=EEE
    REPLAYGAIN_ALBUM_GAIN=-18.09 dB
    REPLAYGAIN_TRACK_GAIN=-18.09 dB
    -----
    gain.awk
    Code:
    #!/usr/bin/awk -f
    
            BEGIN { FS="[ =]"; ag=1000; tg=1000; }
        /artist=/ { a=$0; }
         /title=/ { t=$0; }
         /album=/ { al=$0; }
    /ALBUM_GAIN=/ { ag=$2; }
    /TRACK_GAIN=/ { tg=$2; }
           /----/ {
                    if( tg<x )
                    { 
                      print a; print t; print al;
                      printf("track gain: %s, album gain: %s\n", tg, ag);
                      print "---------";
                    }
                    a=""; t=""; al=""; ag=1000; tg=1000;
                  }
    Code:
    $ ./gain.awk -v x=-4 gain_test.txt 
    artist=AAA
    title=AAA
    album=AAA
    track gain: -5.51, album gain: -5.09
    ---------
    artist=BBB
    title=BBB
    album=BBB
    track gain: -6.31, album gain: -6.09
    ---------
    artist=CCC
    title=CCC
    album=CCC
    track gain: -7.09, album gain: -7.09
    ---------
    artist=DDD
    title=DDD
    album=DDD
    track gain: -8.09, album gain: -8.09
    ---------
    artist=EEE
    title=EEE
    album=EEE
    track gain: -18.09, album gain: -18.09
    ---------
    $ ./gain.awk -v x=-8 gain_test.txt 
    artist=DDD
    title=DDD
    album=DDD
    track gain: -8.09, album gain: -8.09
    ---------
    artist=EEE
    title=EEE
    album=EEE
    track gain: -18.09, album gain: -18.09
    ---------
    $ ./gain.awk -v x=-20 gain_test.txt 
    $
    in other words: works here
    Last edited by Vaphell; November 30th, 2012 at 01:52 AM.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  9. #29
    Join Date
    Jan 2011
    Beans
    52

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    Quote Originally Posted by Vaphell View Post
    file with dummy data:
    Code:
    artist=AAA
    album=AAA
    title=AAA
    REPLAYGAIN_ALBUM_GAIN=-5.09 dB
    REPLAYGAIN_TRACK_GAIN=-5.51 dB
    -----
    artist=BBB
    album=BBB
    title=BBB
    REPLAYGAIN_ALBUM_GAIN=-6.09 dB
    REPLAYGAIN_TRACK_GAIN=-6.31 dB
    -----
    artist=CCC
    album=CCC
    title=CCC
    REPLAYGAIN_ALBUM_GAIN=-7.09 dB
    REPLAYGAIN_TRACK_GAIN=-7.09 dB
    -----
    artist=DDD
    album=DDD
    title=DDD
    REPLAYGAIN_ALBUM_GAIN=-8.09 dB
    REPLAYGAIN_TRACK_GAIN=-8.09 dB
    -----
    artist=EEE
    album=EEE
    title=EEE
    REPLAYGAIN_ALBUM_GAIN=-18.09 dB
    REPLAYGAIN_TRACK_GAIN=-18.09 dB
    -----
    gain.awk
    Code:
    #!/usr/bin/awk -f
    
            BEGIN { FS="[ =]"; ag=1000; tg=1000; }
        /artist=/ { a=$0; }
         /title=/ { t=$0; }
         /album=/ { al=$0; }
    /ALBUM_GAIN=/ { ag=$2; }
    /TRACK_GAIN=/ { tg=$2; }
           /----/ {
                    if( tg<x )
                    { 
                      print a; print t; print al;
                      printf("track gain: %s, album gain: %s\n", tg, ag);
                      print "---------";
                    }
                    a=""; t=""; al=""; ag=1000; tg=1000;
                  }
    Code:
    $ ./gain.awk -v x=-4 gain_test.txt 
    artist=AAA
    title=AAA
    album=AAA
    track gain: -5.51, album gain: -5.09
    ---------
    artist=BBB
    title=BBB
    album=BBB
    track gain: -6.31, album gain: -6.09
    ---------
    artist=CCC
    title=CCC
    album=CCC
    track gain: -7.09, album gain: -7.09
    ---------
    artist=DDD
    title=DDD
    album=DDD
    track gain: -8.09, album gain: -8.09
    ---------
    artist=EEE
    title=EEE
    album=EEE
    track gain: -18.09, album gain: -18.09
    ---------
    $ ./gain.awk -v x=-8 gain_test.txt 
    artist=DDD
    title=DDD
    album=DDD
    track gain: -8.09, album gain: -8.09
    ---------
    artist=EEE
    title=EEE
    album=EEE
    track gain: -18.09, album gain: -18.09
    ---------
    $ ./gain.awk -v x=-20 gain_test.txt 
    $
    in other words: works here
    Hello again Vaphell,

    Ok, I'll give it another look and another try. If it works there with you then I must be fingering something up here. With that said if I can't get it to work this time I will try to find another way of doing it. I want to thank you so much for your efforts in trying to help me out. You have been very helpful and gracious with your time and code

    Cheers Vaphell and all the best!

    Singtoh

  10. #30
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,366
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Bash Script outputs to text file But it's not in alphabetical order?

    seriously, create a small file with few fake records (even 1 will do) with some made up numbers so you can run predictable tests. Debugging logic flaws with hundreds of records is not the way to go. Move to real data once you nail the tests.

    modify BEGIN block so you can check if x is what you think it is, eg
    Code:
    BEGIN { FS="[ =]"; ag=1000; tg=1000; printf( "threshold: %s\n", x ); }
    this will print x at the very top of the output.

    Besides i have no idea what your code looks like now.
    And for the love of god, don't quote 2 pages of text/code :/, if i want to see it again i can scroll up just fine
    Last edited by Vaphell; November 30th, 2012 at 04:38 AM.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

Page 3 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •