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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -