Finding file name

Hi,
I use this command "find . -name "*.html" | xargs cat | grep "searchCriteria" " to find string searchCriteria in any file having html as extension.
I get the output searchCriteria if that string is in the file name.. But, what if I want to know the location of html file from which searchCriteria was displayed?
Regards,

The grep command does not need "cat":
find . -iname "*.html" | xargs grep -i "Search Criteria"(match and search is also case insensitive)
I get the output searchCriteria if that string is in the file name.. But, what if I want to know the location of html file from which searchCriteria was displayed?Not sure if I understand you here. Can you give an example?
Edited by: Dude on Jul 1, 2011 1:18 AM

Similar Messages

  • How do I find file names containing special character

    hi all
    I need your help with a code that deals with finding file names containing special characters like * / \ : ? " |
    the reason is I am doing a project that transfer files and folders from Mac to Windows. But names containing above characters cant be moved to windows.
    the part of the code I write is like this
    set illegal_syntax to paragraphs of (do shell script "find " & quoted form of POSIX path of oneFolder & " -name '*'")
    if (illegal_syntax is not equal to {""}) then
    repeat with each_record in illegal_syntax
    do shell script "/usr/bin/ditto -c -k -rsrc --keepParent " & quoted form of each_record & space & quoted form of (each_record & ".zip")
    end repeat
    end if
    First of all that '' will gives me an error.
    Second, what i tried to do is once the file/folder is found, zip it at current location. But the problem is how can I zip it without the special character? or should I just give it a name, like "originalfile.zip";?
    Last, or maybe you have better idea to deal with this situation? BTW, I can not rename or delete the file/folder because customer won't allow me to do it.

    The backslash is used to escape characters in AppleScript, so if you want to use it in a string you need to escape the escape character, for example "\\*".
    You could set the name of the archive by replacing the illegal character with another one, such as an underscore:
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; border: 1px solid #000000; width: 720px; color: #000000; background-color: #FFDDFF; overflow: auto">set each_record to "some*file*name" -- example
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "*"}
    set the ItemList to text items of each_record
    set AppleScript's text item delimiters to "_"
    set each_record to the ItemList as text
    set AppleScript's text item delimiters to TempTID
    log each_record --> some_file_name
    </pre>

  • Finding File Name And Using It To Place The Graphic Using VBscript

    I'm trying to find a file name (example, <place:E:\logo.tif>) in each text frame if it's there, then remove the text from the frame and then place the file in the frame. This is to get around the feature missing from InDesign that is in PageMaker that allowed you to import inline graphics using tagged text. Below is what I have come up with so far. The file name is currently hard coded in the example below.
    Thanks,
    Archie
    For I = 1 to cInt(myMountNumber)
    Set myTextFrames = myDocument.TextFrames
    Set myCurrentFrame = myTextFrames.Item(I)
    If myCurrentFrame.Texts.ItemByRange (1,7).Contents = "<Place:" Then
    Set myLastCharacter = myCurrentFrame.Characters.Item(-2)
    myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents = ""
    myCurrentFrame.InsertionPoints.Item(1).Place ("E:\sxs\pm65\Sundco.jpg")
    myCurrentFrame.Fit idFitOptions.idProportionally
    End If
    Next

    ' For I = 1 to cInt(myMountNumber)<br />For I = 1 to myDoc.TextFrames.Counts<br />' I think your myMountNumber is equal to TextFramesCount<br /><br />' Set myTextFrames = myDocument.TextFrames<br />' Set myCurrentFrame = myTextFrames.Item(I)<br />' you don't need to get reference to ALL TextFrames in EACH iteration<br /><br />Set myCurrentFrame = myDocument.TextFrames.Item(I)<br />' get reference to Ith TextFrame in document<br /><br />' If myCurrentFrame.Texts.ItemByRange (1,7).Contents = "<Place:" Then<br />If left(myCurrentFrame.Texts.Item(1).Contents,7) = "<Place:" Then<br />' looks better and should be faster<br /><br />   ' Set myLastCharacter = myCurrentFrame.Characters.Item(-2)<br />   ' myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents = ""<br />   ' you don't need these lines - you will delete contents in PLACE line<br />   <br />   ' myCurrentFrame.InsertionPoints.Item(1).Place ("E:\sxs\pm65\Sundco.jpg")<br /><br />   myFile = Mid(myCurrentFrame.Texts.Item(1),8)<br />   ' get all after "<Place:"<br /><br />   myFile = Split(myFile,">")(0) ' get all to ">"<br />   ' small trick ;) when split - get array - but we can use (0) to refere to first element<br /><br />   myCurrentFrame.Texts.Item(1).Place(myFile)<br />   myCurrentFrame.Fit idFitOptions.idProportionally<br />End If<br /><br />Next<br /><br />and I don't think that iterating TextFrames collection is good way ...<br />you should iterate Stories collection and refer to first TextFrame - unles you are sure what you are doing ;) and you have Stories where each TextFrame will have image inside ...<br /><br />robin<br /><br />-- <br />www.adobescripts.com

  • Music files in the Finder: File Names Obscured

    OS X 10.10.2.
    When I search for music in the Finder, it returns metadata titles instead of the file names.
    The reason I do a music search in the finder is to sort and edit the actual file names. Not happy.
    General, Finder and Spotlight preferences just shrug at me.
    Any ideas?

    BeeblePete wrote:
    If so, that's really unfortunate. It means I can't use search to see and resolve duplicate or inconsistent file names. It kind of dilutes the Finder's role as a file manager, when there's already an app for managing the metadata (iTunes).
    Well, in Apple's world, you don't manage files. You manage Music, and Photos, etc.
    If you just open a Finder window without searching, you can manage the files as files.
    The best solution I can think of for the duplicates is to turn on the status bar. If you create a search folder for kind:music and sort by name, you'll see all the duplicate titles. When you select one, it will show the path at the bottom of the window, including file name. You can arrow between the files to determine where you have duplicates and delete or move as desired.

  • Annoying new Finder file name editing setting

    This is new in Leopard and it is beginning to annoy me very much. It happens when editing file names in a sub-folder view – the one where the expand arrow is expanded.
    When editing a long file name I am used to using the arrow keys (up places the insertion point at the beginning; down places it at the end; left and right move it left and right). Hold down the left arrow key to get to the middle of the text quickly and the sub-folder closes. Previous to Leopard the command key+left arrow did this, not just the arrow on it's own. This means that you either have to use to mouse to click where you want to edit, or press the left arrow key multiple.
    I have the key repeat rate set to high so the insertion point moves quickly.
    Has anyone else seen this?

    Yes, it's a bug. Please report it to the link below - the more the merrier:
    http://developer.apple.com/bugreporter/
    On the bright side, at least they finally fixed Option-Right Arrow for disclosure triangles.

  • Finder file name display

    None of my files in a finder window are arranged in alphabetical order. How can I re-arrange them into alphabetical order? Thanks in advance.

    Arranging by name doesn't seem to list files alphabetically if your view mode is 'columns' - it works in the other modes - does anyone have the same problem and if so how to fix it? Any advice would be much appreciated

  • Cannot find '\\file\name'. Verify the path or Internet address is correct. Cannot find any answer any where in this forum.

    I cannot find any answer any where in this forum. PLEASE Help!!!   I'm receiving this error message every I click on the link, this only happen
    on the desktop, but Laptop has no problem to access the file, and everyone else in my group --they don't have issue.
    Run Windows 7 Enterprise SP 1, IE ver 9 and 11
    Thanks in advance.
    Akira

    Hi,
    Could please clarify the steps to reproduce this issue? Did this issue occur when clicking on a link in an email message within Outlook?
    If I didn't misunderstand it, please first try to log into the web mail to check if this issue persists.
    If problem didn't exist in webmail, please try to open your Internet Explorer with no add-on mode to troubleshoot the issue. See:
    http://support.microsoft.com/kb/976915/en-us
    If above didn't fix the issue, please try to reset your Internet Explorer to check the result:
    http://support.microsoft.com/kb/923737/en-us
    Note: Resetting Internet Explorer isn't reversible, and all previous settings are lost after the reset.
    Hope this helps.
    Regards,
    Steve Fan
    TechNet Community Support

  • Spotlight does not find files with "_" (underscores), but only for certain file types

    Hey Folks,
    this is strange, maybe someone has an idea.
    I already searched the internet for a while, nothing found so far.
    I have a file "calc_mean.m" on my desktop.
    When I type "calc" in spotlight, it shows the file.
    But when I type "calc_" it suddenly does not show the file anymore. Nor does find the file, when I enter "calc_mean.m" in spotlight.
    When I enter "calc mean.m" in spotlight, it finds it (using space instead of the underscore).
    Now comes the real surprise:
    When I rename the file to "calc_mean.txt", spotlight suddenly DOES find the file when entering "calc_mean.txt".
    I recreated this "feature" with other files, copying and renaming ".txt" files to ".m" files, and if there's a underscore in the file, spotlight wont find it.
    Playing around a bit more, it seems spotlight does find files with underscore when they are documents, at least it works for the following extensions:
    .pdf
    .doc
    .txt
    .xls
    But these extensions for example do not work:
    .mp3
    .m
    .k
    .a
    .ka
    (and other random endings I tried).
    I am pretty confused. Sure it's no big deal learning to search for files that include underscores in their name using space instead. But I'm still quite puzzled. Any idea?

    All of those have meaning in various database search syntax (not sure if it matters).
    _ usually means any character.
    % usually means any run of characters.
    - is often used to negate what comes next, i.e. "don't include results that have the following text."
    I don't see any problem on my Mac, though.
    I also don't have any problem finding file names with those accented characters using Spotlight. I would suggest reindexing Spotlight, but if cmd-f finds them, I'm not sure that would help.
    Spotlight: How to re-index folders or volumes

  • How to get IOErrorEvent file name

    I hvae load  "test.swf" file .If file not found  how to show the dinamically not find file name.
    var url:String = "test.swf";
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
    var request:URLRequest = new URLRequest(url);
    loader.load(request);
    function ioErrorHandler(event:IOErrorEvent):void {
        trace("ioErrorHandler: " + event);

    Yeah, As it should... url is a property of a valid loaded media.
    Thinking about it - I don't believe there is a native way to read  URLRequest's url on Loader. But requested URL can be read off of Event text property. Not very elegant but it does the trick:
    function ioErrorHandler(e:IOErrorEvent):void
         var pattern:RegExp = /(?<=URL:\s).+/g;
         trace(e.text.match(pattern));

  • A Good Reference for Aperture, Versions, File Names, Changing & Moving

    I was wondering if there is a consensus on a good reference for understanding how Aperture handles files?
    Versions and file names.
    How do you change them in Aperture?
    What happens if you change them in Finder?
    Do I need versions? (can't I just us file names?)
    What about moving the masters, or changing where there are located at in Finder?
    Can I do that in Aperture?
    Can I only do that in Finder?
    Should I never do that in Finder?
    The reason I'm looking for a good reference is because I haven't found one. The user guide (or manual) that comes with Aperture doesn't help with these issues. Search file name and nothing comes back.
    I did get a copy Apple Pro Training Series book for Aperture 3. But I don't think it does a good job explaining how Aperture's file system works, especially in relation to Finder.
    Rather than fill this forum with endless questions (which could be answered by reading the manual and using it the software) I'd like to get a better understanding, from a good source.
    I've only used iPhoto for Mobile Publishing, ATV and now Photo Stream. I don't use it to organize my decades of photos. I don't like having all my photos inside a managed database, which I don't have to do with Aperture. I never understood why you'd want to change the name of a photo in iPhoto, when it never changes the file name. If you send it to someone, after you changed it's name, the other person gets the photo with the original (still in Finder) file name.
    Thanks.

    I never understood why you'd want to change the name of a photo in iPhoto, when it never changes the file name.
    This may help or not but here goes.
    There's a distinction to be made between files and the data they contain. The example I use is as follows: In my iTunes Library I have a file called 'Let_it_Be_The_Beatles.mp3'. So what is that, exactly? It's not the song. The Beatles never wrote an mp3. They wrote a tune, some lyrics, recorded it and a copy of that recording is stored in the mp3 file. The file is just a container for the recording. That container is designed in a specific way attuned to the characteristics and requirements of the data. Hence, mp3.
    Similarly that Jpeg / tiff/ raw/ whatever is not your photo, it's a container designed to hold that kind of data. And along with that data comes opportunities: Metadata, for a start. Exif and IPTC contain vast amounts of information - some it very basic, like the date and time the shot was taken - some of it quite complex, like a lot of details of the settings used in the camera.
    Aperture, iPhoto et al are all about the data and not the file. Import the file and forget about it. Process the image - crop it, fix red eye, run it through the whole gamut of tools in the App and the file never changes at all. Create multiple versions of the image. But there's still only one file. Name it. You name the photo - and that is an entry in the Exif or IPTC. The name of the photo has nothing to do with the name of the file. Because the file is just the tin for the beans.
    Even when you export, unless you specifically choose to export the Master, you are exporting the processed Photo into a different container - that's why you can export Raw as Jpeg, or Jpeg as Tiff. Because the process of export just puts the image into a new container.
    Basically, if you want to manage files you need to use a File Manager. But you're using a Photo manager and expecting it to behave like a file manager.
    And, of course, apps like Aperture and iPhoto have the option to use the Title of the photo as filename on export to the new file.
    Does that muddy the waters?

  • Identifying image and video file names in my presentation

    I want to identify the file names of all the images and videos in my Keynote presentation so that I can re-assemble the presentation in Final Cut Pro . . .  I thought that just using Inspector might give me the file names, but it only shows me what the image or video looks like, but not the file names.
    My photo images are not in iPhoto (I don't use iPhoto), they're in various other folders.
    Thank you.

    There are two ways to find file names of media used in Keynote:
    1
    for a few images, select the images on the slide
    Inspector > Builds
    click on more options
    if there are no builds set up, choose an effect
    the file name will display in the build order:
    2
    It is more usefull and easier  to do the following:
    right click the Keynote file and select     Show Package Contents
    all the images and QuickTime files will be listed
    you can make a screen grab to make a note of the file names (in finder -  command shift 4)
    the files can be copied to a folder and imported into other applications for further work

  • Wildcard support in File names

    Hi,
    How can I do the following.
    I want to find file names matching with abc*.txt format in a given directory.
    It should give abc1.txt,abc2.txt,abc3.txt as output.
    Is it possible to do ?
    Tx

    Sure, change that globbing string to an ordinary regular expression {noformat}(*){noformat} and use a FileFilter for your list( ... ) or listFiles( ... ) method.
    kind regards,
    Jos
    {noformat}(*){noformat} Left as an exercise for the reader ;-)

  • Cannot move any files into trash to delete them. I get a Trash warning box saying "The Finder cannot complete the operation because some data in 'file name' could not be read or written.(Error code - 36)".Macbook has so much data it is almost not working

    Cannot move any files into trash to delete them. I get a Trash warning box saying "The Finder cannot complete the operation because some data in 'file name' could not be read or written.(Error code - 36)".Macbook has so much data it is almost not working.
    I have tried reseting to factory settings by removing battery and holding down the power switch for more than 5 sec but this does nothing.
    Any ideas would be greatly appreciated as I think with so much unwanted data on the desktop and other places the whole os will crash very soon.
    Thanks, Rick

    The hard drive may be dying anyway, or the directory damaged because it is so full.  You should never let the hard drive get over 85% full.
    A -36 error is a read/write error.
    All you did with the power is reset the SMC.  Does nothing to reset everything to factory settings. 
    Do you have your original 10.4 installer discs for the MacBook?
    Is your data backed up?

  • [SOLVED] Find and replace quotes with underscores in file names

    I was looking to replace all of the quotes in file names in a directory with underscores.  I seem to be having a problem doing so, though.  Running the find command:
    find . -name '*[\`\'\"]*' -exec sh -c "mv -i '$0' '${0//[\`\'\"]/_}'" {} \;
    I get a > inviting me to continue the command.  What am I doing wrong?
    Last edited by gogi-goji (2010-01-03 02:19:13)

    @lolilolicon: yeah the -exec part does give another level of quotes, so you can run into trouble with scripts inside -exec.
    I didn't know you could give {} as an argument after sh -c and $0, that solves the problem of not knowing which quotes to use around it in the -exec part.
    $ find -mindepth 1 -exec sh -c 'mv -v --backup=t "$0" "$(echo "$0" | sed s/[\\x27\"\`]/___/g)"' {} \;
    mv: `./a b' and `./a b' are the same file
    `./\'' -> `./___'
    `./\'"\'' -> `./_________'
    mv: `./$0' and `./$0' are the same file
    mv: `./a' and `./a' are the same file
    mv: `./$(echo crash)' and `./$(echo crash)' are the same file
    `./"' -> `./___' (backup: `./___.~1~')
    `./\'\'\'' -> `./_________' (backup: `./_________.~1~')
    Or with the other substitution method, it doesn't interpret \x27 (you could use $(echo -e \\x27) or you have to use ...'\\\''...
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//['\\\''\"\`]/___}"' {} \;
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//[$(echo -e \\x27)\"\`]/___}"' {} \;
    mv -v --backup=t ./a b ./a b
    mv -v --backup=t ./' ./___
    mv -v --backup=t ./___ ./___
    mv -v --backup=t ./'"' ./_________
    mv -v --backup=t ./$0 ./$0
    mv -v --backup=t ./___.~1~ ./___.~1~
    mv -v --backup=t ./a ./a
    mv -v --backup=t ./$(echo crash) ./$(echo crash)
    mv -v --backup=t ./_________ ./_________
    mv -v --backup=t ./" ./___
    mv -v --backup=t ./''' ./_________
    mv -v --backup=t ./_________.~1~ ./_________.~1~

  • How can I find the name of a file I downloaded four months ago?

    I downloaded a file on either February 15th or 16th. Embarrassingly, I've lost the file, simply by forgetting its name. I need to be able to search my download history, by date. Does anyone know of a way to do this? I know that the history is kept that long, and that I haven't erased the history. Finding the date that I visited the website was easy using history and an approximate date, but download history is less intuitive.
    And, no, revisiting the website doesn't help; the only way to find the name of the file there (it's an ebook) is to buy it again, which is NOT what I wish to do.
    This was in Windows 7 Home Premium Edition, with FireFox v. 28.0 (yes, I know it's outdated; I haven't been using that computer much lately). I don't know what version of FireFox was installed at the time of the download -- whatever was most current at the time, as I usually make a practice of installing updates.

    The downloads folder in the history manager? I'm not sure what you mean.
    When I click on History, I see what I've put in the screenshot. Then it starts telling me where I've been today. Nothing about downloads, per se. I've been getting at those through Tools/Downloads.
    I have FireFox set up to ask me where downloads should go, rather than automatically sending them to my Downloads folder in Windows, and even if it had automatically saved to Downloads, it wouldn't still be there now.
    In a pinch, I suppose I could skip the first few in the downloads list, and then start right-clicking on individual downloads and selecting Go To Download Page, but I was hoping there might be some way to narrow it down, by getting at the date on downloads. That's fairly easy in History, but I don't see any way to do it in Tools/Downloads.

Maybe you are looking for