multiline pattern matching
Hi all,
i am finding it difficult to handle multiline pattern matching. problem is like this. I have a formatted text file, in which each column has width of 'X'number of character. So when a text in column exceeds 'X' number of character, then remaining character are placed in next line. same happens with other column of text file too. now, i have to do search for a string which is of length > 'X' number of character. now problem is my search string is in single line and text file contains this search string in multiple line because of column width. how to search it? Thanks in advance |
I know what you have written is probably clear to you, but I am way lost. How about you show an actual example of the input and the desired output?
Also, what have you tried? |
Quote:
Code:
# Name Age If the first field is empty for all continuation lines, then this is quite easy to solve using awk. GNU awk versions 2.1.3 and later do have a facility that makes this much easier, but it's not too hard with any awk -- this is for any awk: Code:
awk 'BEGIN { RS="[\t\n\v\f\r ]*[\r\n]+" Another alternative is to reconstruct the data, using e.g. tabs \t or pipes | as the field separator: Code:
awk ' Hope this helps. |
All times are GMT -5. The time now is 03:05 AM. |