I want to extract some content after a matching pattern from a file.
$ cat test
setenv se_boot_opt heap=0x100000 node_type=IB
namedalloc GWUP_FEATURE_MEMORY_BLOCK 0x480000000 0x16093A000
namedprint
setenv se_boot_opt2 heap=0x256000 node_type=AB
I need to process the input file line by line. For each line it need to check the following.
If the line starts with
setenvword then it should omit the first 2 words and print/output the remaining content in that line.If the line starts with
namedallocthen it should replace withuboot_namedallocword.
I want to have only the below lines in my output.
heap=0x100000 node_type=IB
uboot_namedalloc GWUP_FEATURE_MEMORY_BLOCK 0x480000000 0x16093A000
namedprint
heap=0x256000 node_type=AB