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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...