Finding a file with ls command

 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Finding a file with ls command
# 1  
Old 10-23-2015
Finding a file with ls command

Code:
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP AM v2.mxf
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP AM v3.mxf
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP EM v2.mxf
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP EM v3.mxf

the above 4 files are in a folder.

I am using the code below to find a file in the folder that starts with AGA143.

set x to do shell script "ls '/volumes/NEWS_MASTERS/News Masters/" & proj_code & " '*"

I get the following result

Code:
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP AM v2.mxf
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP AM v3.mxf
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP EM v2.mxf
/volumes/NEWS_MASTERS/News Masters/AGA143 SCHWEIZER SETUP EM v3.mxf

ALL I NEED IS THE LAST FILE IN THE LIST. OR ANY FILE WITH AGA143 IN THE NAME.

Any help on how to do this. I'm actually using Applescript.

Last edited by Corona688; 10-23-2015 at 04:02 PM..
# 2  
Old 10-23-2015
Please use code tags as required by forum rules!

Last file by which key? I'd think you need some piping like ls | sort | tail.
# 3  
Old 10-23-2015
sorry about the code tags, I'll try to remember.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command for finding RAM size in HP-UX

I am trying to find RAM size in my HP-UNIX server. what command I should use for this? I am using top command but not clear about below line from top o/p Memory: 1517080K (471284K) real, 1877692K (751256K) virtual, 8078944K free Page# 1/6 (3 Replies)
Discussion started by: venkatababu
3 Replies

2. Shell Programming and Scripting

cp Command not finding files

I am completely stumped. I am attempting to run the cp command in the following context: cp '/home/spinner0205/directory/directory/*.log' '/home/spinner0205/otherdirectory/combined.txt' The "directory" contains anywhere from 5-50 something.log files. I want to copy the contents of these... (4 Replies)
Discussion started by: spinner0205
4 Replies

3. Shell Programming and Scripting

Finding some records with sed command

Hi for all! sorry guys for my dumb question, but I'm really need help so, we have file with many many fields, like this one: 201001002359 blablabla 87654321 201001002359 123,56 77272588300 blablabla/123 91823778544and I wrote awk command awk '{if($6~/(2588300|2580000|2587021)$/)print}'so,... (8 Replies)
Discussion started by: shizik
8 Replies

4. Shell Programming and Scripting

finding * in command line argument

I have to write a script to determine whether given command line argument ($1) contains "*" symbol or not, if $1 does not contains "*" symbol add it to $1, otherwise show message "Symbol is not required". For e.g. If we called this script q5 then after giving , $ q5 /bin Here $1 is /bin, it... (5 Replies)
Discussion started by: cynosure2009
5 Replies

5. Shell Programming and Scripting

awk command for finding field in a file

hi guys i have this file with column number 7 as below: 0 1416 49 37 5 3 2 0 0 0 21 0 26 ... (5 Replies)
Discussion started by: npatwardhan
5 Replies

6. Shell Programming and Scripting

Finding Heap size Command--Urgent

Hi Friends, i need a unix command to check the heap space availability on unix system as I am getting following error: Error occurred during initialization of VM Could not reserve enough space for object heap Error occurred during initialization of VM Could not reserve enough space for... (2 Replies)
Discussion started by: Anji
2 Replies

7. UNIX Desktop Questions & Answers

Finding USB version on command line

Would anyone happen to know what to grep for finding the version of the USB ports are on the system through the command line? Thanks. (1 Reply)
Discussion started by: eightysix
1 Replies

8. Shell Programming and Scripting

Shell Command for finding out Firefox version

Hi I need a shell command for finding out Firefox browser verion on linux machine. Waiting for your reply. Thanks and Regards, Kammy. (0 Replies)
Discussion started by: kjannu
0 Replies

9. Windows & DOS: Issues & Discussions

Finding printers from a command prompt

Does anyone know how I can find printers from a dos prompt? I'm trying to create a batch file which cats the printers and their locations to another file which I will use later in the script. Maybe windows has a file from which I may read in this information? Thanks! (1 Reply)
Discussion started by: gseyforth
1 Replies

10. UNIX for Dummies Questions & Answers

Finding out how long a command takes to run

Hi I am trying to find out the best way to find out how long a command takes to run in miliseconds .. Is there such a way of doing this in Unix ? Thanks (3 Replies)
Discussion started by: cfoxwell
3 Replies
Login or Register to Ask a Question