Skip to content
Advertisement

+ Regular Expression not working in sed

Team,

I have a file with data as mention below.

JavaScript

Expected Output:

JavaScript

I am using sed its not working .

JavaScript

Please Let me know how to achieve the above mention output.

Advertisement

Answer

This might work for you (GNU sed):

JavaScript

This method matches the numbers at the front of the string with strings appended to the end of the line and then appends them to end of the introduced line. Eventually there are no more numbers to remove and then the introduced newlines/final space are deleted, leaving the required string.

N.B. Additional strings may be appended for further numbers.

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