I have a text file with the following characteristics:
- each line has at least three words separated by a space
- "word" can be any character or string of characters
I added some notes to some of the preliminary suggestion lines for making changes to the original words, and now I would like to use sed to make these changes for me. So, to get a sharper image, my file looks like this:
NO NO O
SIGNS NN O #NNS
GIVEN VBD B-VP #VBN
AT IN O
THIS NN O
TIME NN O ## B-NP
. PER O
...
Notes with 1 # replace the word SECOND in the string, and notes with 2 # replace the word THIRD in the string. Can anyone suggest a way to do this with sed (or awk or something else)? Again, to clarify (hopefully), my goal is to get the pattern following # or ##, and replace the nth word of the string with a matching pattern.
Thank.
source
share