Search in Scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Search in Scripts
# 1  
Old 05-03-2016
Search in Scripts

Hi

I'd like to search content of my apple scripts and list the results. What I have is:

Code:
find /Scripts -name "*.scpt" -exec osadecompile '{}'  \; | xargs -0  grep -l "POSIX"

With that instruction I get no result. What's wrong?

Any tip or hint is welcome.

Regards

Lazy

Last edited by Scrutinizer; 05-03-2016 at 04:42 AM.. Reason: coDE tags
# 2  
Old 05-03-2016
Without any knowledge what the output of osadecompile could possibly be, I'm afraid I'm out of ideas. But, it would need to separate its output lines with the NULL character for the xargs -0 option; find's -print0 action won't do.
# 3  
Old 05-03-2016
Alternatively, try:
Code:
find . -name "*.scpt" |
while read file
do
  osadecompile "$file" | grep -q POSIX && echo "$file" 
done

--
or:
Code:
find . -name "*.scpt" -exec bash -c "osadecompile '{}' | grep -q POSIX && echo '{}'" \;

--
The problem in post #1 is that the file name gets lost (or rather becomes "stdin" to grep) when using the pipe and xargs -0 makes no sense since there is no null-character separated input..

Last edited by Scrutinizer; 05-03-2016 at 05:45 AM..
# 4  
Old 05-03-2016
works perfectly

Thanks

Lazy

---------- Post updated at 02:50 PM ---------- Previous update was at 02:33 PM ----------

one last question:

how would the code be with a second grep?

Lazy
# 5  
Old 05-03-2016
What do you mean with "a second grep" ?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - How to update header of scripts in one pass - multiline search/replace

Hello. A find command return a list of file. For each fileReplace the content starting with the first "§" (of two) ending with last "ɸ" (of two), regardless of the content ( five lines ) by the following content (exactly) : §2019_08_23§ # # ... (8 Replies)
Discussion started by: jcdole
8 Replies

2. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

3. Shell Programming and Scripting

Using Twitter search API to find Vine videos - with UNIX Shell Scripts

I wish to search most recent Vine videos with a search string. On Twitter web interface I search "vine.co rammstein". Output should be Vine URL for example https://vine.co/v/hAF6iXiFUbr, also short https://t.co/QxmaJSBF9D is OK Never used Web APIs with Shell Scripts. (2 Replies)
Discussion started by: slashdotweenie
2 Replies

4. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

5. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

6. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

7. Shell Programming and Scripting

Help with Script using rsh and scripts within scripts

Hi, I've written a script that runs on a Database server. It has to shutdown the Application server, do an Oracle Dump and then restart the Application server. Its been a long time since I wrote any shells scripts. Can you tell me if the scripts that I execute within my script will be executed... (3 Replies)
Discussion started by: brockwile1
3 Replies

8. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies

9. Shell Programming and Scripting

script to search and edit scripts

Hi all, can you please help me in this one.. i have a many scripts in a directory & i get many requests to change the code of a particular script. for example file abc.txt contains #!/bin/bash mumbai 102403445 chennai 123980123 delhi 3456268468 kolkata 465376832 #kolkat 462945959 ... (3 Replies)
Discussion started by: geeko
3 Replies
Login or Register to Ask a Question