bash - search through file for data and create new txt file with just that data -


i have txt file output machine bunch of writing/data/paragraphs not used graphing purposes, somewhere in middle of file have actual data need graph. need search file data , print data txt file can graph later.

the data in middle of file looks (with each data file potentially having different amounts of rows/columns , numbers separated spaces):

<>  1   2   3   4   5   6   etc.    1.2 1.3 1.4 etc.  b   0.2 0.3 0.4 etc.  c   2.2 2.3 2.4 etc.  etc. 

my thinking far grep '<>' find first line (grep '^<>' file) i'm not sure how account variable amount of rows/columns when trying find them. also, using awk loop on .txt files in directory , print new outfile can multiple files @ once (so maybe can search/printing in awk well?).

edit:

--input/expected output file--

input file

this data  here paragraphs  <>  1   2   3      1.2 1.3 1.4  b   0.2 0.3 0.4  c   2.2 2.3 2.4  more paragraphs  more paragraphs 

output file:

<>  1   2   3      1.2 1.3 1.4  b   0.2 0.3 0.4  c   2.2 2.3 2.4 

using awk multiple txt files in directory.

here's 1 in awk. looks <> or decimal number ([0-9]+\.[0-9]+) in record. if that's not enough, maybe try expand decimal number testing part test 3 numbers, like: (/ [0-9]+\.[0-9]+){3}/

$ awk '/<>/||/[0-9]+\.[0-9]+/' foo <>  1   2   3   1.2 1.3 1.4 b   0.2 0.3 0.4 c   2.2 2.3 2.4 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -