1

我该怎么做呢:

# Insert a line "heater:M21789" before the line beginning with "fan"
$ sed '
/^fan/ i\
heater:M21789
' order789.txt

取自http://unstableme.blogspot.com/2009/01/insert-append-change-lines-using-sed.html

在 AppleScript 中?

4

1 回答 1

0

删除了示例的 txt 文件:

set theInput to "title:
PO for vessel unit1 const.
items:
fan:F34539
tube:L1245
driller:M4545
Description:
PO signed and verified by factory manager S K Lp
Date: Fri Jan 2 17:26:44 UTC 2009
Author: M Kumar"


set xxx to do shell script "echo " & quoted form of theInput & " | sed '
/^fan/ i\\
heater:M21789
'"

return xxx

或严格遵守您的示例,对于 ~/ 中的文件 order789.txt

do shell script " cd ~; 
sed '
/^fan/ i\\
heater:M21789
' order789.txt"
于 2012-04-12T20:07:12.927 回答