• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Find text with shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find text with shell script


  • Subject: Re: Find text with shell script
  • From: dev_sleidy <email@hidden>
  • Date: Sun, 6 Aug 2006 07:52:26 -0400

Could anyone tell me the shell script that would find a line of text in a file containing a certain word? For example, if a file contained the text "MyFileName" followed by the word I wished to find, what shell command would reveal that word?

Thanks,
Garry Simon

UNIX 'grep' command.

Example 01:

do shell script "grep 'mail.gna.org/public/' /Users/s/Desktop/_123.txt"

Replace "mail.gna.org/public/" with your search string.
Replace '/Users/s/Desktop/_123.txt' with your file's full path.

Example 02:

set tString to "'mail.gna.org/public/'" -- Replace "mail .... public/" with your string.
set flle_path to "/Users/s/Desktop/_123.txt" -- Replace '/Users/s/Desktop/_123.txt' with your file's full path.


do shell script ("grep " & tString & " " & flle_path)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Find text with shell script
      • From: Axel Luttgens <email@hidden>
References: 
 >Find text with shell script (From: "Simon, Garry" <email@hidden>)

  • Prev by Date: Re: Deleting INBOX.msf for Netscape Email
  • Next by Date: Re: Length of string as UTF-8
  • Previous by thread: Find text with shell script
  • Next by thread: Re: Find text with shell script
  • Index(es):
    • Date
    • Thread