Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17759

How would you sed replace this random string of numbers?

$
0
0

Say I had a text output like this:

  • text[10000]
  • text[742]
  • text[98671]
  • text[5]
  • text[9999999]

Where it's always "text[$RANDOM]" where $RANDOM is a random number inside of brackets immediately after some other text. I can't seem to nail the sed formula to simply change "text[$RANDOM]" to just "text"?

Important probably: the text[98671] bit would be inside of a larger array of text, like "Jan 11 2011 foo[2347834] blah blah blah blah blah", and I'm trying to convert it to "Jan 11 2011 foo blah blah blah blah blah".

submitted by AmericanDerp
[link] [7 comments]

Viewing all articles
Browse latest Browse all 17759

Trending Articles