Jump to content

Replacing some text


Recommended Posts

Yes, the SA does appear after the 6 - 9 numbers, and that's what I was needing to accomplish. First, identify the 6 - 9 numbers, then replace the SA that follows.

 

As I mentioned earlier, a colleague managed to do it with perl, so it's not that important, but I expected sed could do it somehow. I'm just limited in my knowledge of sed to be able to complete it, and so was interested in how it might work.

 

I tried a combination of pauls with silversurfers:

 

sed 's/^*[0-9]{6,9}SA/-newsa-/ 1' < file > file2

 

find the numbers from 6 - 9 in length, then locate the SA which follows, but it didn't work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...