This is what I’m trying to do: Replace all instances of a period with (1) a period, (2) a new line and a (3) semicolon. There are a lot of questions about this that I’ve been looking at but they assume a lot of programmer knowledge. Here are some things I need to do, that I don’t know how to do:
- Write the path of the txt you want to do a find and replace in correctly.
- Writing the find and replace command.
- Choosing what unix tool to use (support for inserting new lines is necessary).
- Launching it correctly from terminal.
- How to represent newline in the relevant tool.
- There’s probably something else I haven’t thought of.
You can do this with
awk.What this does is to view each line of the text file
filename.txtas a record separated by periods, rebuilding the record with the period, newline, and semicolon as a new field separator.Addendum To capture the output into a file, use a redirection like this: