Hi,
I want to convert a single row values to multiple rows, but the no. of rows are not fixed.
For example, I have a row as below
abc-def-lmn-mno-xyz
out put should be
get abc
get def
get lmn
get xyz
Hi,
I want to convert a single row values to multiple rows, but the no. of rows are not fixed.
For example, I have a row as below
abc-def-lmn-mno-xyz
out put should be
get abc
get def
get lmn
get xyz
awk '$0="get "$0' RS=- infile
You'll get an extra trailing newline.
Or:
awk -F- '{
for (i = 0; ++i <= NF;)
print "get", $i
}' infile
Hi radoulov...
The OP shows a listing omitting the mno
block.
This may be a typo so I will ask the OP here:-
@Suneel Mekala...
Is the "mno" block deliberately omitted or is it a typo?
If it IS deliberately omitted then will it/they always be in the position shown?
Hi wisecracker,
yes, I've noticed that, but I believe that's a typo.
Waiting for the OP's reply.
Hi wisecracker,
"mno" was omitted because of typo.