I'm looking for a way to generate an awk file using sed. The problem at hand is, I have a text file with about 1000 rows of words and I want to be able to extract each line from the text file and use the word extracted as a regex in an awk file.
For example the text file will read:
James Class1
Toby Class3
Callum Class4
Sarah Class1
Jeremiah Class2
Output to awk using sed should look like
/ reg exp for James/ {action matching word has Class1}
/ reg exp for Toby / {action matching word has Class3}
/ reg exp for Callum / {action matching word has Class4}
/ reg exp for Sarah / {action matching word has Class1}
I've tried extracting all the words using sed but can't seem to find a way to write that to an awk file!
sedfor creating anawkprogram? Please be more clear with more details in your post and let us know then.action matching word has Class1etc or you want it actual code some conditions to be printed in a script or etc which you want to execute it later?I'm looking for a way to generate an awk file using sed.- that makes zero sense. If you can parse the input file with sed then you can certainly parse it with awk and if you can produce an awk script to do something from sed then you can just write the awk script to do whatever that something is. Tell your teacher to come up with a more useful/realistic exercise.