We would like to create a bash script that selects lines having documentName string and for each line print out values for: titleName, documentName and serverName
That was the obvious choice, you are right. But in this case we need to stick to the content itself, not to the file variable.
What was requested is that also the file+timestamp information (before >>) is added.
An awk $1 is not the same as a script (bash, ksh, csh...) $1 .
While $1 is a variable within all scripts, $1 is the first field of the currently parsed inputline.
Hi sea,
Just so we don't confuse tandrei too much, I think you have a typo above. In awk , $1 is the first field of the current input line; not the first column in the output.
With RudiC's script, tandrei will probably need to look at $1 and $2 (or use a different substr(...) after matching the file and timestamp terminator ( > )). With my script, $1 will be sufficient, but FS ERE will need to be updated to add >> as another field separator.