I have a file (file_name
) which contains exactly one occurance of the string Result:
, at the start of a line. I want to print all the characters after the string Result:
in that line until I encounter a space. Which shell command should I use?
grep "Result: " file_name | tail -c +9
is not working.
Best Answer
The simplest way would be to use
awk
.That matches lines that begin with
Result:
, and prints the second field in the file, as defined by the default $IFS, which is whitespace.