It is stil not ideal, I send you some other forms if input text:
hd0,2 instead (hd0,2)
It deletes some spaces: products "linuxroot" instead "linux root"
Products "/boot(UUID=" instead "/boot (UUID="
and "/boot" instead "/boot (UUID=eab515e9-" Edit: I wanted to specify that I need to remove something (UUID=...) that follows the kernel or initrd word.
In my original code I tried to identify UUID format \(UUID=[-0-9a-f]*\ not to be confused with block list (hd?,?). (I am not sure if UUID can have big letters)
I think it is not lucky: sub(/[()]/,"",$2) it removes the parantheses whatever it it uuid od hd. Or Map! map (hd0) (hd1)
I want to ask you about this: r=$3$4; does it mean, you rely on IFS=$' '? How we get $3 and $4 ?
It is difficult when there is a lot of different things coming new with every new example of your input.
Best might be to just post all different examples and possibilities and according to that your expected output. Else it will never be completed
Sorry. It is always hard to me to explain what I work with and where I am going to. I always try to simplify things therefor I 1st publish the simplest form... To better understand. But I see this doesn't work and it is just on the contrary...
No worries - as said, best try to gather what you want to do with a complete example of the input (describing cases etc. with comments) and a complete example of the wanted output.
There is a lot of more people here in the forum which will be able to help for sure - having a break from work for today, see you tomorrow
It is good you showed me how to identify the 1st found result of (kernel|init).
Now I would need to access the content of parenthesis (.*) by some referencer.
I will do a remake. In this example I use //1 as a referencer (it is kust to show where I want to access the captured word).
I have this code:
Is some referencer to access the parenthesis? The FS - spaces and $1,$2,$3 referencer is a problem for me. I would better not use it. I don't know if the \\1 referencer is only for gensub? If I could use this I would use print \\1\\2\\3\\4 to print the content of parenthesis.
---------- Post updated at 08:54 PM ---------- Previous update was at 08:07 PM ----------
I have found interesting thread about storing data and backreferences . So I don't know if is it possible to do it in awk. Maybe if somebody would do it in perl.
Hi, here I am again. I have learned some basic about perl and I am bringing a solution. If zou know better way how to do it in perl, show it to me. I am newbie to perl :-)
The text I work with 3 lines:
Now it is on one line, but later I get it to array with 3 rows.
---------- Post updated at 10:23 PM ---------- Previous update was at 06:00 PM ----------
Step A) This code removes 1st UUID=... from the line with kernel (or initrd) and move it to newline as uuid UUID=...
1) I needed to recognize if the initrd or kernel was found - therefor the step A was done now.
2) If step A is done, then I do second part. I print the initrd without UUID and without "uuid"
B) I do increment $n++ for setting the array in which I have the lines.
C) ($1 eq "") is necessary to recognize if kernel or initrd was find. If not, then I need to put original line as value to the array.
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)