315 reputation
310
bio website
location
age
visits member for 2 years, 4 months
seen May 3 at 1:59
stats profile views 12

Apr
15
awarded  Popular Question
Mar
13
awarded  Notable Question
Dec
26
awarded  Notable Question
Sep
25
asked Trouble installing or booting into Ubuntu or Fedora using a live USB or DVD on a new Lenovo E31
Jul
31
awarded  Nice Question
May
23
awarded  Popular Question
Feb
16
awarded  Popular Question
Jan
4
awarded  Yearling
Apr
27
comment Best way to follow a log and execute a command when some text appears in the log
Thanks, -n 0 will help. In my current case, a little fragility isn't an issue because I'm just going through experimental iteration. From another question, I found that grep -m 1 "server is up" <(tail -n 0 -f /path/to/serverLog); some_command avoids problems with a pipe remaining alive when I expect it to die and have the command terminate.
Apr
26
comment Best way to follow a log and execute a command when some text appears in the log
I found an alternative, though I don't know how solid it is: tail -f /path/to/serverLog | grep "server is up" | head -1 && do_some_command
Apr
26
comment Best way to follow a log and execute a command when some text appears in the log
@penguin359, True, but it'd still be interesting to do it from the command line as well. In my case, there are a variety of different things I'd want to do including many things I can't foresee, so it's convenient to be able to just start the server and do it all in one line.
Apr
26
comment Best way to follow a log and execute a command when some text appears in the log
I like the awk solution for being short and easy to do on the fly in one line. However, if the command I want to run has quotes, this can be a bit cumbersome, is there an alternative, maybe using pipelines and compound commands that also allows a brief one-liner solution but doesn't require the resulting command to be passed as a string?
Apr
26
accepted Best way to follow a log and execute a command when some text appears in the log
Apr
26
revised Best way to follow a log and execute a command when some text appears in the log
added 27 characters in body
Apr
26
asked Best way to follow a log and execute a command when some text appears in the log
Apr
23
accepted sort but keep header line in the at the top?
Apr
23
comment sort but keep header line in the at the top?
@Mikel: OK, changing to IFS= didn't fix this problem. However, changing to printf '%s\n' "$REPLY" fixed it for this approach. I haven't noticed an effect from setting IFS. What is this fixing?
Apr
23
comment sort but keep header line in the at the top?
(read;...) seems to lose the spacing between the fields of the header for me. Any suggestions?
Apr
23
comment sort but keep header line in the at the top?
I came across the following link. However, I can't get this technique of { head -1; sort; } to work. It always deletes a bunch of the text after the first line. Does anyone know why this happens?
Apr
23
comment sort but keep header line in the at the top?
+1, any reason why a subshell is preferable, or is {} ok instead of ()?