LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-02-2010, 11:42 AM   #1
nickvence
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 1
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 ...
 
Old 04-02-2010, 12:01 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I'm not quite getting the problem statement. Please post a "before and after" example.
 
Old 04-05-2010, 04:34 PM   #3
nickvence
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 1
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
 
0 members found this post helpful.
Old 04-05-2010, 08:33 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
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.
 
Old 04-06-2010, 12:02 AM   #5
nickvence
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 1
My apologies. I welcome your advice, while respecting your time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
awk regex with variable bertl1982 Linux - General 2 03-17-2010 08:38 AM
What should some Regex match in awk? sebelk Programming 7 11-20-2009 06:38 PM
Awk regex question uncle-c Linux - Newbie 2 03-03-2009 08:30 AM
awk regex question Guest1234 Programming 6 12-25-2007 01:31 PM
Newbie SED / AWK / Regex command help request Critcho Linux - Newbie 10 03-19-2007 11:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration