Use tail’s --pid
option and tail will stop when the shell dies. No need to add extra to the tailed file.
sh -c 'tail -n +0 --pid=$$ -f /tmp/foo | { sed "/EOF/ q" && kill $$ ;}'
More Related Contents:
- shell – remove numbers from a string column [closed]
- How to print lines between two patterns, inclusive or exclusive (in sed, AWK or Perl)?
- How to select lines between two marker patterns which may occur multiple times with awk/sed
- Awk replace a column with its hash value
- Enhancement of unix script [closed]
- Get lines between two patterns
- How to delete from a text file, all lines that contain a specific string?
- Bash tool to get nth line from a file
- Find and replace in file and overwrite file doesn’t work, it empties the file
- How to delete duplicate lines in a file without sorting it in Unix
- How to use multiple arguments for awk with a shebang (i.e. #!)?
- Insert line after match using sed
- How can I shuffle the lines of a text file on the Unix command line or in a shell script?
- sed whole word search and replace
- How can I delete a newline if it is the last character in a file?
- Using awk with variables
- How to insert a newline in front of a pattern?
- Alternative to `sed -i` on Solaris
- How to get the second column from command output?
- How can I check the version of sed in OS X?
- Sed to extract text between two strings
- Insert multiple lines into a file after specified pattern using shell script
- Trim leading and trailing spaces from a string in awk
- Remove part of path on Unix
- How can I pass variables from awk to a shell command?
- Read file into String and do a loop in Expect Script
- Replace whitespace with a comma in a text file in Linux
- How to add text at the end of each line in unix
- How to print 5 consecutive lines after a pattern in file using awk [duplicate]
- How to grep for case insensitive string in a file?