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

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

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -

asp.net - call stack missing info on mono with apache and mod_mono -