Skip to content
Advertisement

Remove eveything before including colon and replace comma to newline

I am looking just to accommodate my query into one-liner.

I have a below file content where i want to remove all before last colon(:) including itself and then replace comma(,) into newline to get the desired results.

these all comma separated values are linux user ID’s

File content:

JavaScript

Already tried:

working solution:

JavaScript

result:

JavaScript

Is there a better trick, please advise.

Advertisement

Answer

You may use this solution on any version of awk:

JavaScript

Using gnu-sed it will something similar to your attempted code:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement