 |
 |
Grep question..
|
 |
|
 |
|
Senior User
Join Date: Jul 2001
Status:
Offline
|
|
I have a script that runs in BBedit and it's smaller cousin. But I need it to be a separate app like an apple script app. I know that it uses GREP to do it's work. but I do not know how to make it just use grep without the bbedit program.
Code:
tell application "TextWrangler"
activate
«event R*chRepl» "^TITLE:.*\\r|^FCM:.*\\r|^M2.*\\r|^\\*.*\\r|^\\n+\\*.*\\r|^\\x1A\\x1A\\x1A\\x1A+.*" given «class Repl»:"", «class FnIn»:text 1 of «class TxtW» 1, «class Opts»:{«class SMod»:«constant SModGrep», «class STop»:true, «class Wrap»:false, «class Rvrs»:false, «class Case»:false, «class Wrds»:false, «class ExSl»:false}
«event R*chRepl» "V\\s+|C\\s+|D\\s+|K\\s+|B\\s+" given «class Repl»:"", «class FnIn»:text 1 of «class TxtW» 1, «class Opts»:{«class SMod»:«constant SModGrep», «class STop»:true, «class Wrap»:false, «class Rvrs»:false, «class Case»:false, «class Wrds»:false, «class ExSl»:false}
«event R*chRepl» " \\d\\d\\d " given «class Repl»:"", «class FnIn»:text 1 of «class TxtW» 1, «class Opts»:{«class SMod»:«constant SModGrep», «class STop»:true, «class Wrap»:false, «class Rvrs»:false, «class Case»:false, «class Wrds»:false, «class ExSl»:false}
«event R*chRepl» " \\([A-Z]\\) " given «class Repl»:"", «class FnIn»:text 1 of «class TxtW» 1, «class Opts»:{«class SMod»:«constant SModGrep», «class STop»:true, «class Wrap»:false, «class Rvrs»:false, «class Case»:false, «class Wrds»:false, «class ExSl»:false}
«event R*chRepl» "\\sO\\s" given «class Repl»:"", «class FnIn»:text 1 of «class TxtW» 1, «class Opts»:{«class SMod»:«constant SModGrep», «class STop»:true, «class Wrap»:false, «class Rvrs»:false, «class Case»:false, «class Wrds»:false, «class ExSl»:false}
«event R*chRepl» "([:\\d\\d]) ([\\d\\d:])" given «class Repl»:"\\1\\t\\2", «class FnIn»:text 1 of «class TxtW» 1, «class Opts»:{«class SMod»:«constant SModGrep», «class STop»:true, «class Wrap»:false, «class Rvrs»:false, «class Case»:false, «class Wrds»:false, «class ExSl»:false}
«event R*chRepl» "( +)" given «class Repl»:"\\t", «class FnIn»:text 1 of «class TxtW» 1, «class Opts»:{«class SMod»:«constant SModGrep», «class STop»:true, «class Wrap»:false, «class Rvrs»:false, «class Case»:false, «class Wrds»:false, «class ExSl»:false}
end tell
and the file is this
http://www.aprilcolo.com/oh/plink/mic/edl.EDL.zip
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status:
Offline
|
|
Using the system tools grep or awk will probably do what you want. I think something like awk is what you need if replacing text. The grep tool only searches.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
|
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
Perl, definitely a job for perl.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jul 2001
Status:
Offline
|
|
I treid a bunch of stuff. But my script will not work.
I need it to use sed I supose. but it needs to open up a file and write a new file beside it in the same folder. Can you help ? Or is there a good link to a perfect apple script tutorial ?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jul 2001
Status:
Offline
|
|
When I try
do shell script command at the end of the line it tells me that end tell is no good.
Anyother clue how to ruun it as an app ?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jul 2001
Status:
Offline
|
|
a while back someone kindly created this
Code:
cat infile | tr "\r" "\n" | sed -e '/^[0-9]\{4,\}/\!d;s/\([^ ]* [^ ]*\)[A-Z0-9 ]* \(.*\)/\1 \2/' > outfile
but I could never run it for some reason. should it be like ?
Code:
cat filedirty | tr "\r" "\n" | sed -e '/^[0-9]\{4,\}/\!d;s/\([^ ]* [^ ]*\)[A-Z0-9 ]* \(.*\)/\1 \2/' > fileclean
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jul 2001
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|