extracting fields

extracting fields

Post by zachary bro » Sun, 24 Dec 1995 04:00:00

I posted awhile ago asking for suggestions on how to extract
multi-line fields that are separated by 5 newline characters. I found
the following one liner that does it:

cat ${1} | tr '\n' '_' | sed s/_____/^/g | tr '^' '\n' | grep "${2}" |
tr '\n' '^' | sed s/"\^"/"_____"/g | tr '_' '\n'

Does anyone know any simpler/faster/more elegant way to do it?



1. Extract fields from records with complicated structure


I would like to come up an efficient way to extract certain fields
from a binary record:

This record has 700 possible layouts, each layout has a structure code.
The record's average size is 130 bytes.
Each record can have different number of fields, it is decided by its

Also, some layouts are decided by a nested if-else-then rules.

Does anyone have any similar experience to deal with this records?

How to make the lookup part of extraction efficient?

Any help or pointer will be appreciated!


2. MakeFiles

3. awk - extracting field between "'"

4. Pearl, What is it?

5. Newbie - extracting fields in ksh

6. Problem with DNS - or what?

7. extracting fields by keyword from large text file, using bash

8. HELP!

9. faster way to extract fields from large file?

10. How do I extract a field between two other fields?

11. OK I think this one can only be solved by a pro. (Extract fields and table from a .sql file

12. How to extract second field in ps command output?

13. Extracting date fields using sed and awk