Skip to main content
better syntax
Source Link

Text processing should be done with shell script. Usually it can be done in one short line:

sed 's;[^0's;^[^0-9]29]*2 TEXT1;& MY TEXT HERE;' text_file.txt

Assuming there wasn't some sort of indentation problem above. Based on what it sounds like you meant though, here's another solution:

sed 's;[^0's;^[^0-9]29]*2 TEXT1;&\'$'\n'' MY TEXT HERE;' text_file.txt

AppleScript is not the right tool for this job.

Text processing should be done with shell script. Usually it can be done in one short line:

sed 's;[^0-9]2 TEXT1;& MY TEXT HERE;' text_file.txt

Assuming there wasn't some sort of indentation problem above. Based on what it sounds like you meant though, here's another solution:

sed 's;[^0-9]2 TEXT1;&\'$'\n'' MY TEXT HERE;' text_file.txt

AppleScript is not the right tool for this job.

Text processing should be done with shell script. Usually it can be done in one short line:

sed 's;^[^0-9]*2 TEXT1;& MY TEXT HERE;' text_file.txt

Assuming there wasn't some sort of indentation problem above. Based on what it sounds like you meant though, here's another solution:

sed 's;^[^0-9]*2 TEXT1;&\'$'\n'' MY TEXT HERE;' text_file.txt

AppleScript is not the right tool for this job.

Source Link

Text processing should be done with shell script. Usually it can be done in one short line:

sed 's;[^0-9]2 TEXT1;& MY TEXT HERE;' text_file.txt

Assuming there wasn't some sort of indentation problem above. Based on what it sounds like you meant though, here's another solution:

sed 's;[^0-9]2 TEXT1;&\'$'\n'' MY TEXT HERE;' text_file.txt

AppleScript is not the right tool for this job.