Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ...
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.