Quote:
Originally Posted by
earnstaf
Edit: I used your code on a single record and it worked like a charm. Is there any way I can get that same output on multiple records?
Edit2: Disregard the below... I kept your RS=' ' the same and ran the code on an entire 400 record file, and it did output different variables for each record, but with no formatting. I need it to give a newline at the end of each individual record. Ideas?
...
It's unclear ( at least for me ) what's your expected output. Do you need the output as a formatted file, or as only variables set ( no formatting needed ) ?
Are there more extracts than the six ones that you needed before ? If that's the case they need to be explicitly entered into the previous code.
In your previous post you were looking to set extracts as variables; the point here is that if you have the same extracts over many records, their values as variables will be overwritten in the final output ( say, in record 1 -> name=AAA, in record 2 -> name=BBB,... ), so in the end you'll have only ONE variable
set ( say last record 400 -> name=ZZZ ). In case you need all of them, the variable names will have to have different ( say sequential ) names ( example name1, name2,...,name400), to access them separately.
There cannot be two variables with the same name.
Quote:
Originally Posted by
earnstaf
For whatever reason, I couldnt even pipe the output of the awk to something else (sed). Can someone tell me why that is? I imagine it has something to do with how the variables are handled by the eval command.
Simply remove
eval to make the output of the command available to a pipe + other command.
Eval will really evaluate ( execute ) the buried value of a statement, it can be a variable or command, so when the pipe comes, it's too late, the variables are already set and no more std input for the pipe.
Can you post about 10 lines of your input, your
final expected output, and some more info regarding my above points ?