shell - Unix Sed to get lines from a last occurance of a given word -
i want lines file line contains last occurance of given word.
ex:
true, there have been some
changes in plot. in original,
kane tried buy high political
office himself. in new version,
puts politicians on payroll.
if give "in" need
office himself. in new version,
puts politicians on payroll.
try:
grep 'yourword' yourfile.txt | tail -n1
or sed:
sed -n '/yourword/{$p}' yourfile.txt
Comments
Post a Comment