need help with extracting text blocks in unix

July 17, 2009 at 01:03:22
Specs: UNIX

I have a little problem. In a textfile I have something like this:

parameter1 = value

parameter1 = value
parameter2 = value
parameter4 = value

parameter2= value
parameter3 = value

(the length of the user-name and parameter-name is different)

Now I want to extract the parmeters and values for each user block. So I can say wich user has wich parameter.

But I donĀ“t know how.

Can you help me please?


See More: need help with extracting text blocks in unix

Report •

July 17, 2009 at 05:50:01
echo "enter :"
read user
awk -v user=$user 'BEGIN{ RS=""}$0 ~ user{    print  } ' file

GNU win32 packages | Gawk

Report •

July 29, 2009 at 06:21:54

thnaks it works great. ;-)

Report •

Related Solutions

Ask Question