Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have a very, very, very long list. Like over 830,000 characters. I will of course perform said command on a copy.

There are multiple lines, like this


I want that to turn out like this


This must be possible with sed, awk or similar?

The reason im not using Sumblime text is because all lines do not have a number before them.

share|improve this question

You can use sed:

sed -e 's/[0-9]*=/=/' < data

This replaces (s) any text that is zero or more characters in the range 0-9 followed by an = sign with just the = sign.

share|improve this answer
s/[0-9]+=/=/ might be easier to mentally map to the OP's request, but either should work just as well. Also, I'd probably redirect the output to a file too. :) Even so, +1. – Michael Kjörling Aug 9 '14 at 22:10
+ is annoyingly non-standard. – Michael Homer Aug 9 '14 at 22:12
just for completeness' sake you can also use [:digit:] as in sed -e 's/[:digit:]*.=/=/g' < data – Dani_l Aug 9 '14 at 22:47
@Dani_l, you have to put the character class inside brackets: s/[[:digit:]]*=/=/ – glenn jackman Aug 9 '14 at 23:17
@glennjackman did you try my solution? both work. Don't forget the period "." after the star "*". – Dani_l Aug 14 '14 at 14:48

If you want to remove every number that comes before '='

awk -F= '{gsub(/[[:digit:]]/, X, $1)}1' OFS== file

Above code satisfies even if there multiple numbers scattered before '='

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.