LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   awk/regex with a post (https://www.linuxquestions.org/questions/linux-newbie-8/awk-regex-with-a-post-799612/)

nickvence 04-02-2010 11:42 AM

awk/regex with a post
 
I have a data file with the following format
0 i j # # # #
with other random lines of text to be filtered out.

The following script works when there aren't many #s, but it shuffles long lists of data.
/^0/ {
split($0,token)
printf("%s %s\t", $2, $3)
for ( i in token ) {
if( token[i] ~ /[1-9].[0-9]+e/ ) {
printf("%s\t", token[i])
}
}
printf( "\n" )
}


I would like to use a stack to pop off my indicies and print the rest of the #s.
Could someone point me in the right direction?
Nick

FYI: the data look something like this
0.00000000 0.00000000 0.05000000 1.51079660e-07 2.32405561e-07 ...

pixellany 04-02-2010 12:01 PM

I'm not quite getting the problem statement. Please post a "before and after" example.

nickvence 04-05-2010 04:34 PM

I have rewritten this script in python, and I don't plan to revisit the awk version.

The before was a list of lists 400+ numbers (intermixed with text which I wanted to remove). The numbers were (almost) monotonically increasing when graphed
The after should have been the same lists of 400+ numbers; however, the numbers were mixed up groups of 10 surviving together. My guess is that this had to do with my misuse of regular expression.
Thanks for your interest, and don't bother responding.
Nick

grail 04-05-2010 08:33 PM

Nick

I realise you probably didn't mean it, but "don't bother responding" reads as a little rude.
If you are no longer seeking a response or further help, simply mark the query as SOLVED.

nickvence 04-06-2010 12:02 AM

My apologies. I welcome your advice, while respecting your time.


All times are GMT -5. The time now is 06:53 PM.