I'm hoping this is possible, and as a scenario, its probably a good one
i have a log file, its formatted as two lines per event.
19/12-22:48:43.018 info [myprocess.processid.program]So, when i'm grep'ing for lines of events, i'm using cat myfile | grep "actual line of data" - but the data i need is on the line above so i'm using cat myfile | grep -B1 "actual line of data" to return both lines.
actual line of data output
Now i need to get some elements of the first line so i'm using cut - eg var=$(cat myfile | grep -B1 "actual line of data" | cut -c1-2)
problem i have now is this makes $var equal to '19' and 'ac'
is there an equivalent to -B for cut - or a way of only passing the first line of the two to cut? ideally i use "actual line of data output" as my search, but only grab the line before, not both..
as always, thanks for all the assistance