Hello,
I'd like to know how to find a specific string sequence in files.
For instance, suppose that the file1 holds a sequence like the following
...
ext3_write_super
ext3_ordered_writepage
journal_blocks_per_page
journal_start
kmem_cache_alloc
block_write_full_page
generic_make_request
journal_dirty_data
journal_stop
ext3_write_inode
ext3_bmap
generic_block_bmap
ext3_write_super
ext3_ordered_writepage
journal_blocks_per_page
kmem_cache_alloc
...
I would like to know the line number and count all the sequence like:
ext3_ordered_writepage
journal_blocks_per_page
journal_start
kmem_cache_alloc
the sequence must be matched exactly in file1. Wrt to file 1, the sequence
occurs twice.
I've tried with
Code:
grep -nFf sequence_to_find file1
but it's not what I'm looking for.
in "sequence_to_find" there are the former sequences.
I'd like to have an output like:
count 2
2 ext3_ordered_writepage
3 journal_blocks_per_page
4 journal_start
5 kmem_cache_alloc
13 ext3_ordered_writepage
14 journal_blocks_per_page
15 journal_start
16 kmem_cache_alloc
Is there any way to do that?
Thank you in advance