in reply to Re: parse a line with varied number of fields
in thread parse a line with varied number of fields

I have updated with with some code. I can identify the lines but the number of fields per line can vary.

Cut fields 0-7 and cut fields $NF - -8. What remains is the file name with spaces. The number of fields left to print could be varied, 1 field, 2 fields, ...

Thanks

  • Comment on Re^2: parse a line with varied number of fields

Replies are listed 'Best First'.
Re^3: parse a line with varied number of fields
by Marshall (Canon) on Jul 05, 2012 at 10:01 UTC
    Ok, you have some code now which is a start. However, in general showing some code that "doesn't work" is not that useful unless you also include the actual input, actual output and DESIRED output of that code.

    The best is if I have a runnable code example to see exactly what it does given the input. Then some explanation of what you want it to do.

    Showing the DATA is important.
    Show some examples of these various types of lines - It is possible that I will code it very differently than your formulation.

    If there are X fields at the beginning of some huge line, maybe you don't have so show all of them - maybe just one of the first 8-9 fields here would be sufficient? Show one example of the "whole thing", then the simplified examples where the variations start.