What do you want exactly? To replace only the first occurrence of either `initrd' or `kernel' in the whole stdin text? Or simply replace `kernel' with `kernelXXX' in this particular variable? And what does NFR mean - may be it should be FNR (record number)?
---------- Post updated at 02:37 PM ---------- Previous update was at 02:25 PM ----------
I must to explain you what I want to do.
Originally. I had something like ... kernel (hd0,2) ... root=(hd0,2) .... I replaced it with ...
It is not ideal but what I do in previous code is that I replace (hd?,?) for uuid and uuid for (hd?,?)
My code was:
Original input text was like:
Includes \n twice fot newline character.
See:
I tried your code, but it result in:
---------- Post updated at 03:58 PM ---------- Previous update was at 03:30 PM ----------
What I want to do:
The 1st found result from (..|..) to give on separete line with uuid:
change this:
to this:
It is important to specify we look for kernel or initrd. "initrd (UUID=... " or "kernel (UUID=..." .
Because there also can occur words like "unhide (UUID=" or "hide (UUID=" or similar.
Produces:
It should not remove the title ... and other lines ...
In fact $block doesn't need to have the kernel or init attributes. It can be block for Linux or Windows with map command. So if no kernel or initrd in it, then save it untouched.
Hello
My script has following line and output
find path -type d | awk -F "/" 'NF == 4{print $3}'
path/custype=Type1/logdate=20160414
path/custype=Type11122/logdate=20160414
But I need following output that I need custtype information between "" like... (4 Replies)
This is for PHP preg_match code - which is PCRE therefore looking for a perl compatible suggestion
I have this line returned I want to match and return..
I want to match the two instances of string ending 'ABCXYZ' into an array.
And on second element (ie. RootABCXYZ) only return the word... (4 Replies)
I am facing below issue with my script. below is one of the test out of 50 test from the tool which i m trying to automate. the test may show up or may not depending upon the previous results and also from the test some inputs may be asked or may not be asked depending upon previous results so you... (1 Reply)
Can anyone help it out,
My Requirement:
Actually i grep for the items in the atrblist (Result of it will provide the line where the item present and also the next line of where it presents)then it will be stored in $i.txt
From tat result i wil grep 2nd word after getdate() word and store... (2 Replies)
I have to solve a programming problem for my wife who is engaged in Research in Breast Cancer.
1. She has frequently to search a long single line of alphabetic characters (lower case) for an exact match of a string.
e.g.... (4 Replies)