How to replace value in each field until a certain character in each record?

Each record coming with column names. I have to replace them in each record as shown below

  TIME=20181219110000261|CHAN=FMBKHJBAAAADPCFNAAAAAABA|EVNT=SWIclst|VALU=Session FMBKHJBAAAADPCFNAAAAAABA started|SRC=NSS|UCPU=0|SCPU=0

Output should look like:

20181219110000261|FMBKHJBAAAADPCFNAAAAAABA|SWIclst|Session FMBKHJBAAAADPCFNAAAAAABA started|NSS|0|0

TIA

As always, what have you tried and where exactly are you stuck?

1 Like

Hi,

I was just going to post an answer for this vgersh, however I'll await feedback from the original poster.

Regards

Gull04

2 Likes

Thanks for the response vgersh99 . Honestly, I am new to using unix. I tried some options with awk but the results are not matching with my requirement. Any help would be appreciated.

Hi,

Why don't you cut and paste what you tried, also if you could tell us what OS as there are differences with awk on some operating systems.

Regards

Gull04

Give me a day. I will post the solution by myself. Thanks for the help and thanks for reminding me of my school teacher who checks our homework.

Hi Sudhakar1987,

If this is homework then there is a seperate forum for this, if not then I would refer you back to the previous posts requesting what you've tried.

The forums here deliver help in many forms, however there is an expectation that the users will at least be prepared to share what they have already tried - other users in the main will respond with (in my experience) excellent feed back.

Everybody has to learn a bit at a time, throwing your toys out of the pram will achieve nothing - other than someone else having to pick your toys up for you!

I look forward to seeing your solution;

Regards

Gull04

:wink:
Please do come back with at least the skeleton of what you have to give us a hint about your thought process.
We do want to help - regardless of how it looks on a surface...
This is a good exercise for Unix regex-es and can be solved by more than one approach.

Unfortunately, sudhakar1987 has posted his or her problem in another forum as well and received an - although unsatisfying so far - answer there. So I'm afraid we won't see his or her thought process resp. "solution by myself" in here.

That's too bad - it could have been a good learning opportunity for the OP.
Oh well...